Skip to content

Commit

Permalink
Fix a crashbug in the fold() changes, caused b-- reported by Qon.
Browse files Browse the repository at this point in the history
  • Loading branch information
talvo committed Oct 9, 2016
1 parent 3d4d6fb commit 414fbb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/funlist.c
Expand Up @@ -483,7 +483,7 @@ FUNCTION(fun_fold)
int funccount, per;
char base[BUFFER_LEN];
char result[BUFFER_LEN];
char *list[MAX_SORTSIZE];
char *list[MAX_SORTSIZE] = { NULL };
int n, i = 0;

if (!delim_check(buff, bp, nargs, args, 4, &sep))
Expand All @@ -498,6 +498,10 @@ FUNCTION(fun_fold)
if (nargs >= 3) {
strncpy(base, args[2], BUFFER_LEN);
} else {
if (!n) {
base[0] = '\0';
i++;
} else
strncpy(base, list[i++], BUFFER_LEN);
}
pe_regs = pe_regs_create(PE_REGS_ARG, "fun_fold");
Expand Down

0 comments on commit 414fbb6

Please sign in to comment.