From: Ralph Corderoy Date: Tue, 1 Nov 2016 00:05:42 +0000 (+0000) Subject: anno: Stop segmentation violation on `-number 0'. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/171ad462ce7582196f91f93f91f99fc60a21189e?ds=sidebyside anno: Stop segmentation violation on `-number 0'. If atoi(3) returned zero, either because `0' was given or the number could not be parsed, then the error message dereferenced an invalid pointer. Found when trying to increase coverage with check_exit. --- diff --git a/uip/anno.c b/uip/anno.c index 53769304..c6446fcf 100644 --- a/uip/anno.c +++ b/uip/anno.c @@ -169,7 +169,7 @@ main (int argc, char **argv) number = -1; else if (!(number = atoi(*argp))) - adios (NULL, "missing argument to %s", argp[-2]); + adios (NULL, "missing argument to %s", argp[-1]); argp++; }