Commit 73e93ccc authored by rswindell's avatar rswindell
Browse files

Log files can be very big. Let's not allocate the space for them on the

stack. Use the heap instead.
parent c16bfb2d
......@@ -410,11 +410,12 @@ int view_log(char *filename, char *title)
if(fexist(filename)) {
if((buffile=sopen(filename,O_RDONLY,SH_DENYWR))>=0) {
j=filelength(buffile);
if((buf=(char *)alloca(j+1))!=NULL) {
if(j >= 0 && (buf=(char *)malloc(j+1))!=NULL) {
read(buffile,buf,j);
close(buffile);
*(buf+j)=0;
uifc.showbuf(WIN_MID,0,0,76,uifc.scrn_len-2,title,buf,NULL,NULL);
free(buf);
return(0);
}
close(buffile);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment