CC: | g esp <g.esp [...] free.fr> |
Subject: | Net-SSLeay-1.48 strncpy warning fix |
Date: | Mon, 30 Jul 2012 10:00:57 +0200 (CEST) |
To: | bug-Net-SSLeay [...] rt.cpan.org |
From: | g.esp [...] free.fr |
Compiling with gcc-4.4 and -Wall show this warning (and some others I didn't look at)
SSLeay.xs: In function 'next_proto_helper_AV2protodata':
SSLeay.xs:740: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/usr/include/bits/string3.h:118: note: expected 'char * __restrict__' but argument is of type 'unsigned char *'
Casting to (char *) suppress the warning but I am unsure this is the right fix.
--- Net-SSLeay-1.48/SSLeay.xs.orig 2012-07-29 14:37:13.000000000 +0200
+++ Net-SSLeay-1.48/SSLeay.xs 2012-07-29 17:42:28.000000000 +0200
@@ -737,7 +737,7 @@
if (out) {
/* if out == NULL we only calculate the length of output */
out[ptr] = (unsigned char)len;
- strncpy(out+ptr+1, p, len);
+ strncpy((char *)(out+ptr+1), p, len);
}
ptr += strlen(p) + 1;
}
Patch is attached too in case it is mangled
Another way is changing (and all depending code)
- int next_proto_helper_AV2protodata(AV * list, unsigned char *out)
+ int next_proto_helper_AV2protodata(AV * list, char *out)
but I don't know the range that should support len/next_proto_data
Gilles
Message body is not shown because sender requested not to inline it.