summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/vl
diff options
context:
space:
mode:
authorVinson Lee <vlee@freedesktop.org>2013-02-22 20:33:54 -0800
committerVinson Lee <vlee@freedesktop.org>2013-02-23 14:57:05 -0800
commitf6487e8911399ee62fffd54035c9459256043f9d (patch)
tree3af5a4abb662baba4fd6b563bc0875704499ceeb /src/gallium/auxiliary/vl
parent65aa1a194d703664d2f68e2e6fd69029298ae25a (diff)
downloadexternal_mesa3d-f6487e8911399ee62fffd54035c9459256043f9d.zip
external_mesa3d-f6487e8911399ee62fffd54035c9459256043f9d.tar.gz
external_mesa3d-f6487e8911399ee62fffd54035c9459256043f9d.tar.bz2
vl: Fix off-by-one error in device_name_length allocation.
Fixes out-of-bounds write reported by Coverity. Signed-off-by: Vinson Lee <vlee@freedesktop.org> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Michel Dänzer <michel@daenzer.net>
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys_dri.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 560c914..88e17fe 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -338,9 +338,8 @@ vl_screen_create(Display *display, int screen)
goto free_screen;
device_name_length = xcb_dri2_connect_device_name_length(connect);
- device_name = CALLOC(1, device_name_length);
+ device_name = CALLOC(1, device_name_length + 1);
memcpy(device_name, xcb_dri2_connect_device_name(connect), device_name_length);
- device_name[device_name_length] = 0;
fd = open(device_name, O_RDWR);
free(device_name);