i965: bounds checks while concatenating sysfs paths
authorRobert Bragg <robert@sixbynine.org>
Thu, 16 Mar 2017 22:41:09 +0000 (22:41 +0000)
committerRobert Bragg <robert@sixbynine.org>
Fri, 17 Mar 2017 13:40:29 +0000 (13:40 +0000)
commit76dc49f3fbeb8a44dde6a34bc4e8f6d7dd883cea
tree42ba9d08b565c6a41806ca1f4e73f1d8f7c3f332
parentf8b1b9404e5e584f5915049a5be68898cd383967
i965: bounds checks while concatenating sysfs paths

This adds some missing return value checks for all uses of snprintf in
brw_performance_query.c. This also switches a use of strncpy + strncat
for snprintf for consistency and to avoid the chance of the strncpy
leaving an unterminated string in the dest buffer if the src is too
long.

This issue with strncpy was picked up by Coverity.

CID: 1402201
Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/mesa/drivers/dri/i965/brw_performance_query.c