From: Karel Zak Date: Wed, 11 Mar 2026 10:24:01 +0000 (+0100) Subject: libsmartcols: fix width= property parsing X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=351eae3efe92901aae7066c12f64ea680670a464;p=thirdparty%2Futil-linux.git libsmartcols: fix width= property parsing The code uses 'errno' to detect errors, but the variable is not set to zero before parsing the number. As a result, any previous error can affect the width number parsing. Signed-off-by: Karel Zak --- diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c index a36e54690..461b6a690 100644 --- a/libsmartcols/src/column.c +++ b/libsmartcols/src/column.c @@ -1024,7 +1024,10 @@ int scols_column_set_properties(struct libscols_column *cl, const char *opts) } else if (value && strncmp(name, "width", namesz) == 0) { char *end = NULL; - double x = strtod(value, &end); + double x; + + errno = 0; + x = strtod(value, &end); if (errno || value == end) return -EINVAL; rc = scols_column_set_whint(cl, x);