intel / intel/libva

possible driver path truncation

Open
#222 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
784
Forks
314
PR merge metrics
No merged PRs in 30d

Description

When compiling with gcc 8, it complains about a possible string truncation when constructing the driver path.

```
../subprojects/libva/va/va.c: In function ‘va_openDriver’:
../subprojects/libva/va/va.c:381:9: warning: ‘strncat’ specified bound 1 equals source length [-Wstringop-overflow=]
strncat( driver_path, "/", strlen("/") );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/libva/va/va.c:383:9: warning: ‘strncat’ specified bound 13 equals source length [-Wstringop-overflow=]
strncat( driver_path, DRIVER_EXTENSION, strlen(DRIVER_EXTENSION) );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/libva/va/va.c:380:9: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncpy( driver_path, driver_dir, strlen(driver_dir) + 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/libva/va/va.c:380:43: note: length computed here
strncpy( driver_path, driver_dir, strlen(driver_dir) + 1);
^~~~~~~~~~~~~~~~~~
../subprojects/libva/va/va.c:382:9: warning: ‘strncat’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
strncat( driver_path, driver_name, strlen(driver_name) );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.