Skip to content

possible driver path truncation #222

Open
@ceyusa

Description

@ceyusa

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) );
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions