From 6163a2b1d5bdc76c395f5c7c1d0d8ef445011357 Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Wed, 24 May 2017 09:49:29 -0400 Subject: FIELDWIDTHS parsing should protect against blanks after skip separator, and fix field number in error message. --- field.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'field.c') diff --git a/field.c b/field.c index 54055adc..61f0d7f6 100644 --- a/field.c +++ b/field.c @@ -1182,7 +1182,7 @@ set_FIELDWIDTHS() if (errno == 0 && *end == ':' && (0 < tmp && tmp <= UINT_MAX)) { FIELDWIDTHS->fields[i].skip = tmp; scan = end + 1; - if (*scan == '-') { + if (*scan == '-' || is_blank(*scan)) { fatal_error = true; break; } @@ -1223,7 +1223,7 @@ set_FIELDWIDTHS() if (fatal_error) fatal(_("invalid FIELDWIDTHS value, for field %d, near `%s'"), - i, scan); + i + 1, scan); } /* set_FS --- handle things when FS is assigned to */ -- cgit v1.2.3