aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-07-30 23:23:18 -0500
committerSimon Ser <contact@emersion.fr>2020-07-31 09:32:14 +0200
commitaaf490d794bd077330c306face305f4a87de5809 (patch)
treee4dad61f8f0a3a0e978c9c372d9d631646ec6b56 /backend/drm
parent74f7be728715e164d5b7f174491797ce31206c8d (diff)
drm: fix uninitialized read
get_drm_prop_blob does not set path_len if it returns NULL. Check the return value before path_len to avoid reading uninitialized memory. (Granted, this doesn't change the logic at all, but it does make Valgrind a bit happier.)
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 7ecc28d3..dafe807b 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -1398,7 +1398,7 @@ void scan_drm_connectors(struct wlr_drm_backend *drm) {
bool is_mst = false;
char *path = get_drm_prop_blob(drm->fd, wlr_conn->id,
wlr_conn->props.path, &path_len);
- if (path_len > 4 && path && strncmp(path, "mst:", 4) == 0) {
+ if (path && path_len > 4 && strncmp(path, "mst:", 4) == 0) {
is_mst = true;
}
free(path);