Commit 9fc2fdfc authored by Austin Yuan's avatar Austin Yuan

Fixed strncpy isssue, should copy "\0" too

Signed-off-by: default avatarAustin Yuan <shengquan.yuan@intel.com>
parent fee5a472
...@@ -143,7 +143,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name) ...@@ -143,7 +143,7 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
char *driver_path = (char *) malloc( strlen(driver_dir) + char *driver_path = (char *) malloc( strlen(driver_dir) +
strlen(driver_name) + strlen(driver_name) +
strlen(DRIVER_EXTENSION) + 2 ); 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, "/", strlen("/") );
strncat( driver_path, driver_name, strlen(driver_name) ); strncat( driver_path, driver_name, strlen(driver_name) );
strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) ); strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment