Skip to content

Commit ac196a5

Browse files
ebblakeemaste
authored andcommitted
m4: Allow empty base argument in eval()
POSIX specifies "The second argument, if specified, shall set the radix for the result; if the argument is blank or unspecified, the default is 10." Previously we reported an invalid PR: 287015 Reviewed by: emaste
1 parent 4eabcb7 commit ac196a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

usr.bin/m4/eval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ expand_builtin(const char *argv[], int argc, int td)
181181
int maxdigits = 0;
182182
const char *errstr;
183183

184-
if (argc > 3) {
184+
if (argc > 3 && *argv[3] != '\0') {
185185
base = strtonum(argv[3], 2, 36, &errstr);
186186
if (errstr) {
187187
m4errx(1, "expr: base is %s: %s.",

0 commit comments

Comments
 (0)