diff --git a/src/emx/src/lib/misc/response.c b/src/emx/src/lib/misc/response.c
index 669b7ad..b5a9744 100755
a
|
b
|
void _response (int *argcp, char ***argvp)
|
23 | 23 | { |
24 | 24 | int i, old_argc, new_argc, new_alloc; |
25 | 25 | char **old_argv, **new_argv; |
26 | | char line[1+8192], *p; |
| 26 | char *line, *p; |
27 | 27 | FILE *f; |
28 | 28 | |
29 | 29 | old_argc = *argcp; old_argv = *argvp; |
… |
… |
void _response (int *argcp, char ***argvp)
|
44 | 44 | RPUT (old_argv[i]); |
45 | 45 | else |
46 | 46 | { |
| 47 | long filesize; |
| 48 | |
| 49 | fseek(f, 0, SEEK_END); |
| 50 | filesize = ftell(f); |
| 51 | fseek(f, 0, SEEK_SET); |
| 52 | line = malloc(filesize+1+1); /* 1 for type, 1 for NUL */ |
| 53 | if (!line) |
| 54 | goto out_of_memory; |
47 | 55 | line[0] = __KLIBC_ARG_NONZERO | __KLIBC_ARG_RESPONSE; |
48 | | while (fgets (line+1, sizeof (line)-1, f) != NULL) |
| 56 | while (fgets (line+1, filesize+1, f) != NULL) |
49 | 57 | { |
50 | 58 | p = strchr (line+1, '\n'); |
51 | 59 | if (p != NULL) *p = 0; |
… |
… |
void _response (int *argcp, char ***argvp)
|
54 | 62 | goto out_of_memory; |
55 | 63 | RPUT (p+1); |
56 | 64 | } |
| 65 | free (line); |
57 | 66 | if (ferror (f)) |
58 | 67 | { |
59 | 68 | fputs ("Cannot read response file\n", stderr); |