From 9f89b1da103c5feb289e779b81edb8fcbf2abd6e Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Mon, 22 Oct 2001 17:01:16 +0000 Subject: Report error on setting a limit to a string that os not a decimal number. --- ChangeLog | 3 +++ Src/Builtins/rlimits.c | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 627281417..8c7e158d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2001-10-22 Bart Schaefer + * 16111: Src/Builtins/rlimits.c: Report error on attempt to set + limit to a string that is not a decimal number. + * 16109: Src/init.c: Use a fixed initial fdtable_size to fix crash resulting from a huge memory allocation, as reported in 16082. diff --git a/Src/Builtins/rlimits.c b/Src/Builtins/rlimits.c index f81ce2412..359e04ed0 100644 --- a/Src/Builtins/rlimits.c +++ b/Src/Builtins/rlimits.c @@ -332,7 +332,12 @@ bin_limit(char *nam, char **argv, char *ops, int func) } else if (limtype[lim] == ZLIMTYPE_NUMBER || limtype[lim] == ZLIMTYPE_UNKNOWN) { /* pure numeric resource -- only a straight decimal number is permitted. */ - val = zstrtorlimt(s, &s, 10); + char *t = s; + val = zstrtorlimt(t, &s, 10); + if (s == t) { + zwarnnam("limit", "limit must be a number", NULL, 0); + return 1; + } } else { /* memory-type resource -- `k' and `M' modifiers are permitted, meaning (respectively) 2^10 and 2^20. */ -- cgit 1.4.1