Fixed strncpy isssue, should copy "\0" too 54/354/1
authorAustin Yuan <shengquan.yuan@intel.com>
Fri, 6 Feb 2009 04:23:55 +0000 (23:23 -0500)
committerAustin Yuan <shengquan.yuan@intel.com>
Fri, 6 Feb 2009 04:23:55 +0000 (23:23 -0500)
Signed-off-by: Austin Yuan <shengquan.yuan@intel.com>
src/va.c

index 1eb7117..ad620e3 100644 (file)
--- a/src/va.c
+++ b/src/va.c
@@ -143,7 +143,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
         char *driver_path = (char *) malloc( strlen(driver_dir) +
                                              strlen(driver_name) +
                                              strlen(DRIVER_EXTENSION) + 2 );
-        strncpy( driver_path, driver_dir, strlen(driver_dir) );
+        strncpy( driver_path, driver_dir, strlen(driver_dir) + 1);
         strncat( driver_path, "/", strlen("/") );
         strncat( driver_path, driver_name, strlen(driver_name) );
         strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) );