Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | --- a/kexec/arch/i386/x86-linux-setup.c |
| 2 | +++ b/kexec/arch/i386/x86-linux-setup.c |
| 3 | @@ -176,6 +176,8 @@ static int file_scanf(const char *dir, c |
| 4 | FILE *fp; |
| 5 | int retno; |
| 6 | char filename[PATH_MAX]; |
| 7 | + long line_size = MAX_LINE; |
| 8 | + char *line; |
| 9 | |
| 10 | snprintf(filename, PATH_MAX, "%s/%s", dir, file); |
| 11 | filename[PATH_MAX-1] = 0; |
| 12 | @@ -186,7 +188,14 @@ static int file_scanf(const char *dir, c |
| 13 | } |
| 14 | |
| 15 | va_start(argptr, scanf_line); |
| 16 | - retno = vfscanf(fp, scanf_line, argptr); |
| 17 | + |
| 18 | + line = xmalloc(sizeof(line) * line_size); |
| 19 | + while(fgets(line, sizeof(line), fp) != NULL ) { |
| 20 | + line_size += MAX_LINE; |
| 21 | + line = xrealloc(line,line_size); |
| 22 | + } |
| 23 | + retno = vsscanf(line, scanf_line, argptr); |
| 24 | + |
| 25 | va_end(argptr); |
| 26 | |
| 27 | fclose(fp); |