Message ID | 1507727249-93295-1-git-send-email-phentex@amazon.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 11/10/17 14:07, Paul Semel wrote: > From: Paul Semel <phentex@amazon.de> > > the strcpy function was doing a comparison instead of doing an > assignment. > > Signed-off-by: Paul Semel <phentex@amazon.de> > > Reviewed-by: Pawel Wieczorkiewicz <wipawel@amazon.de> > Reviewed-by: Bjoern Doebel <doebel@amazon.de> > Reviewed-by: Martin Pohlack <mpohlack@amazon.de> Oops. This issue is hidden due to __builtin_strcpy() optimising all in-tree callsites. Reviewed-and-tested-by: Andrew Cooper <andrew.cooper3@citrix.com>, and pushed. > --- > common/libc/string.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/common/libc/string.c b/common/libc/string.c > index 94acc7e..967f2fa 100644 > --- a/common/libc/string.c > +++ b/common/libc/string.c > @@ -24,7 +24,7 @@ size_t strnlen(const char *str, size_t max) It looks like git isn't terribly happy with the (strcpy) preprocessor trick. I did a double-take when I first read the patch. ~Andrew > { > char *p = dst; > > - while ( *p++ == *src++ ) > + while ( (*p++ = *src++) ) > ; > > return dst;
diff --git a/common/libc/string.c b/common/libc/string.c index 94acc7e..967f2fa 100644 --- a/common/libc/string.c +++ b/common/libc/string.c @@ -24,7 +24,7 @@ size_t strnlen(const char *str, size_t max) { char *p = dst; - while ( *p++ == *src++ ) + while ( (*p++ = *src++) ) ; return dst;