From: Martin Mares Date: Fri, 30 Jan 2009 13:05:13 +0000 (+0100) Subject: setpci: Fixed a typo in parsing of values, causing SIGSEGV on some bad inputs. X-Git-Tag: v3.1.1~3 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=f6476d659b07d034bace15498bc2c8a95d413c2b;p=pciutils.git setpci: Fixed a typo in parsing of values, causing SIGSEGV on some bad inputs. Patch by Andreas Wiese. --- diff --git a/setpci.c b/setpci.c index 5521285..21858bd 100644 --- a/setpci.c +++ b/setpci.c @@ -630,13 +630,13 @@ static void parse_op(char *c, struct pci_dev **selected_devices) e = strchr(value, ','); if (e) *e++ = 0; - if (parse_x32(value, &f, &ll) < 0 || *f && *f != ':') + if (parse_x32(value, &f, &ll) < 0 || f && *f != ':') parse_err("Invalid value \"%s\"", value); lim = max_values[op->width]; if (ll > lim && ll < ~0UL - lim) parse_err("Value \"%s\" is out of range", value); op->values[j].value = ll; - if (*f == ':') + if (f && *f == ':') { if (parse_x32(f+1, NULL, &ll) <= 0) parse_err("Invalid mask \"%s\"", f+1);