Use malloc() instead of alloca() to allocate a (potentially) large buffer

for storing the "diff -n" output.  Some files (eg ports/INDEX,v) are too
big nowadays to fit on the stack.

Submitted by: Stephen Montgomery-Smith <stephen@math.missouri.edu>
This commit is contained in:
Stephen McKay 2004-01-26 04:27:22 +00:00
parent b9927716c0
commit 68c42f006d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124994

View File

@ -218,7 +218,7 @@ Equ(const char *dir1, const char *dir2, const char *name, struct dirent *de)
{
u_long l = s2.st_size + 2;
u_char *cmd = alloca(strlen(buf1)+strlen(buf2)+100);
u_char *ob = alloca(l), *p;
u_char *ob = malloc(l), *p;
int j;
FILE *F;
@ -292,6 +292,7 @@ Equ(const char *dir1, const char *dir2, const char *name, struct dirent *de)
s_sub_files++;
s_sub_bytes += s2.st_size;
}
free(ob);
}
finish:
munmap(p1, s1.st_size);