Hey,

I'm resubmitting this patch since the source tree was locked last time I
submitted. Any thoughts?

Thanks,
William Orr

Index: bin/dd/args.c
===================================================================
RCS file: /cvs/src/bin/dd/args.c,v
retrieving revision 1.25
diff -u -b -w -p -r1.25 args.c
--- bin/dd/args.c       21 May 2014 06:23:02 -0000      1.25
+++ bin/dd/args.c       12 Sep 2014 04:51:07 -0000
@@ -323,8 +323,12 @@ get_bsz(char *val)
        size_t num, t;
        char *expr;
 
+       if (strchr(val, '-'))
+               errx(1, "%s: illegal numeric value", oper);
+
+       errno = 0;
        num = strtoul(val, &expr, 0);
-       if (num == SIZE_T_MAX)                  /* Overflow. */
+       if (num == ULONG_MAX && errno == ERANGE)                /* Overflow. */
                err(1, "%s", oper);
        if (expr == val)                        /* No digits. */
                errx(1, "%s: illegal numeric value", oper);

Reply via email to