=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/hexdump/hexsyntax.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- src/usr.bin/hexdump/hexsyntax.c 2003/06/12 20:58:09 1.8 +++ src/usr.bin/hexdump/hexsyntax.c 2007/01/28 16:37:09 1.9 @@ -1,4 +1,4 @@ -/* $OpenBSD: hexsyntax.c,v 1.8 2003/06/12 20:58:09 deraadt Exp $ */ +/* $OpenBSD: hexsyntax.c,v 1.9 2007/01/28 16:37:09 miod Exp $ */ /* $NetBSD: hexsyntax.c,v 1.8 1998/04/08 23:48:57 jeremy Exp $ */ /*- @@ -32,12 +32,13 @@ #ifndef lint /*static char sccsid[] = "from: @(#)hexsyntax.c 5.2 (Berkeley) 5/8/90";*/ -static char rcsid[] = "$OpenBSD: hexsyntax.c,v 1.8 2003/06/12 20:58:09 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: hexsyntax.c,v 1.9 2007/01/28 16:37:09 miod Exp $"; #endif /* not lint */ #include #include +#include #include #include #include @@ -80,7 +81,9 @@ addfile(optarg); break; case 'n': - if ((length = atoi(optarg)) < 0) + errno = 0; + if ((length = strtol(optarg, NULL, 0)) < 0 || + errno != 0) errx(1, "%s: bad length value", optarg); break; case 'o': @@ -88,7 +91,9 @@ add("\"%07.7_ax \" 8/2 \" %06o \" \"\\n\""); break; case 's': - if ((skip = strtol(optarg, &p, 0)) < 0) + errno = 0; + if ((skip = (off_t)strtoll(optarg, &p, 0)) < 0 || + errno != 0) errx(1, "%s: bad skip value", optarg); switch(*p) { case 'b':