Sorry, the libssl patch was unintentional. I forgot to cvs up -C that one.

On 7/13/2014 2:05 AM, Ted Unangst wrote:
On Sun, Jul 13, 2014 at 01:52, William Orr wrote:
Hey,

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

Feedback? Interest?
Yes.

-       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. */
I think you can just use strchr to look for a - anywhere in the
string. It shouldn't be anywhere, right? And use ULONG_MAX to match
strtoul.


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;
Unrelated, but also unnecessary. The malloc above makes it clear
v->section is a unique pointer not aliased with section. memcpy is fine.


Reply via email to