mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-30 11:30:22 +01:00
r300g: Check return value of snprintf().
Would have at least prevented the crash the previous patch fixed.
Cc: 10.4, 10.5 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=540970
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
(cherry picked from commit ade0b580e7)
This commit is contained in:
parent
e0670715bc
commit
57f54b067b
1 changed files with 6 additions and 1 deletions
|
|
@ -541,9 +541,14 @@ unsigned load_program(
|
|||
unsigned *count;
|
||||
char **string_store;
|
||||
unsigned i = 0;
|
||||
int n;
|
||||
|
||||
memset(line, 0, sizeof(line));
|
||||
snprintf(path, PATH_MAX, TEST_PATH "/%s", filename);
|
||||
n = snprintf(path, PATH_MAX, TEST_PATH "/%s", filename);
|
||||
if (n < 0 || n >= PATH_MAX) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
file = fopen(path, "r");
|
||||
if (!file) {
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue