mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 02:10:12 +01:00
r300/compiler/tests: Fix line length check in test parser
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> CC: "9.2" "10.0" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
parent
1896431f79
commit
9a5ce0c4c9
1 changed files with 3 additions and 1 deletions
|
|
@ -542,6 +542,7 @@ unsigned load_program(
|
|||
char **string_store;
|
||||
unsigned i = 0;
|
||||
|
||||
memset(line, 0, sizeof(line));
|
||||
snprintf(path, MAX_PATH_LENGTH, "compiler/tests/%s", filename);
|
||||
file = fopen(path, "r");
|
||||
if (!file) {
|
||||
|
|
@ -552,7 +553,8 @@ unsigned load_program(
|
|||
count = &test->num_input_lines;
|
||||
|
||||
while (fgets(line, MAX_LINE_LENGTH, file)){
|
||||
if (line[MAX_LINE_LENGTH - 2] == '\n') {
|
||||
char last_char = line[MAX_LINE_LENGTH - 1];
|
||||
if (last_char && last_char != '\n') {
|
||||
fprintf(stderr, "Error line cannot be longer than 100 "
|
||||
"characters:\n%s\n", line);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue