Date: Sat, 20 Sep 1997 17:47:30 -0700 (PDT) Message-Id: <199709210047.RAA22706@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: djgpp AT delorie DOT com, dj AT delorie DOT com From: Nate Eldredge Subject: Bug fix: very large response files Precedence: bulk I found a bug in DJGPP's handling of very large response files (src/libc/crt0/c1args.c). The space for the contents of the response file was allocated with `alloca', and so any response file larger than the stack (usually 256K) would cause a stack fault. I have changed it to use `malloc' instead. A patch is included below. Anyone with feedback on this, please let me know. Patch for src/libc/crt0/c1args.c --cut-- *** oldc1arg.c Sun Sep 1 01:09:32 1996 --- c1args.c Sat Sep 20 17:25:34 1997 *************** *** 245,253 **** st_size = lseek(f, 0L, SEEK_END); lseek(f, 0L, SEEK_SET); ! bytes = (char *)alloca(st_size); len = _read(f, bytes, st_size); _close(f); al->argv[i]->arg_file = parse_bytes(bytes, len); expand_response_files(al->argv[i]->arg_file); } } --- 245,254 ---- st_size = lseek(f, 0L, SEEK_END); lseek(f, 0L, SEEK_SET); ! bytes = (char *)c1xmalloc(st_size); /* Changed from alloca --NE */ len = _read(f, bytes, st_size); _close(f); al->argv[i]->arg_file = parse_bytes(bytes, len); expand_response_files(al->argv[i]->arg_file); + free(bytes); } } --cut-- Nate Eldredge eldredge AT ap DOT net