Hey,

I sent a patch similar to this almost a month ago with no response.

Feedback? Interest?

This patch fixes the following:

- Takes negative values
- When SIZE_T_MAX was passed, returns undefined error

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       13 Jul 2014 07:43:07 -0000
@@ -37,6 +37,7 @@
 #include <sys/types.h>
 #include <sys/time.h>
 
+#include <ctype.h>
 #include <err.h>
 #include <errno.h>
 #include <limits.h>
@@ -196,8 +197,7 @@ static void
 f_count(char *arg)
 {
 
-       if ((cpy_cnt = get_bsz(arg)) == 0)
-               cpy_cnt = (size_t)-1;
+       cpy_cnt = get_bsz(arg);
 }
 
 static void
@@ -322,9 +322,16 @@ get_bsz(char *val)
 {
        size_t num, t;
        char *expr;
+       char *vp = val;
 
-       num = strtoul(val, &expr, 0);
-       if (num == SIZE_T_MAX)                  /* Overflow. */
+       while (isspace(vp[0]))
+               vp++;
+       if (vp[0] == '-')
+               errx(1, "%s: cannot be negative", oper);
+
+       errno = 0;
+       num = strtoul(vp, &expr, 0);
+       if (num == SIZE_T_MAX && errno == ERANGE)               /* Overflow. */
                err(1, "%s", oper);
        if (expr == val)                        /* No digits. */
                errx(1, "%s: illegal numeric value", oper);
Index: bin/dd/dd.c
===================================================================
RCS file: /cvs/src/bin/dd/dd.c,v
retrieving revision 1.18
diff -u -b -w -p -r1.18 dd.c
--- bin/dd/dd.c 1 Jun 2013 16:46:49 -0000       1.18
+++ bin/dd/dd.c 13 Jul 2014 07:43:07 -0000
@@ -77,7 +77,7 @@ main(int argc, char *argv[])
 
        atexit(summary);
 
-       if (cpy_cnt != (size_t)-1) {
+       if (cpy_cnt != 0) {
                while (files_cnt--)
                        dd_in();
        }
Index: lib/libssl/src/crypto/conf/conf_api.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/conf/conf_api.c,v
retrieving revision 1.11
diff -u -b -w -p -r1.11 conf_api.c
--- lib/libssl/src/crypto/conf/conf_api.c       23 Jun 2014 22:19:02 -0000      
1.11
+++ lib/libssl/src/crypto/conf/conf_api.c       13 Jul 2014 07:43:09 -0000
@@ -295,7 +295,7 @@ _CONF_new_section(CONF *conf, const char
        if ((v->section = malloc(i)) == NULL)
                goto err;
 
-       memcpy(v->section, section, i);
+       memmove(v->section, section, i);
        v->name = NULL;
        v->value = (char *)sk;
 

Reply via email to