Check for format character precision argument before using it
This commit is contained in:
parent
2dc7e5ff1a
commit
6cf37e9d15
@ -23,3 +23,6 @@ and also if CONVFMT changed.
|
||||
|
||||
7. unary-plus: Unary plus on a string constant returned the string.
|
||||
Instead, it should convert the value to numeric and give that value.
|
||||
|
||||
8. missing-precision: When using the format string "%*s", the precision
|
||||
argument was used without checking if it was present first.
|
||||
|
1
bugs-fixed/missing-precision.awk
Normal file
1
bugs-fixed/missing-precision.awk
Normal file
@ -0,0 +1 @@
|
||||
BEGIN { printf("%*s"); }
|
2
bugs-fixed/missing-precision.ok
Normal file
2
bugs-fixed/missing-precision.ok
Normal file
@ -0,0 +1,2 @@
|
||||
./a.out: not enough args in printf(%*s)
|
||||
source line number 1
|
3
run.c
3
run.c
@ -863,6 +863,9 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co
|
||||
FATAL("'$' not permitted in awk formats");
|
||||
}
|
||||
if (*s == '*') {
|
||||
if (a == NULL) {
|
||||
FATAL("not enough args in printf(%s)", os);
|
||||
}
|
||||
x = execute(a);
|
||||
a = a->nnext;
|
||||
sprintf(t-1, "%d", fmtwd=(int) getfval(x));
|
||||
|
Loading…
Reference in New Issue
Block a user