X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstring%2Fstrlcpy.c;h=4d3ff92a8d79997c139b8a0eaaaefe54e5b7a2e6;hb=3df0b66ee95c837496ae434ba7a2282d97ca71ef;hp=bbebf1db5ec6d27ea092af4be4bfedb933275641;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/string/strlcpy.c b/src/string/strlcpy.c index bbebf1db..4d3ff92a 100644 --- a/src/string/strlcpy.c +++ b/src/string/strlcpy.c @@ -16,12 +16,12 @@ size_t strlcpy(char *d, const char *s, size_t n) const size_t *ws; if (!n--) goto finish; - if (((uintptr_t)s & ALIGN) != ((uintptr_t)d & ALIGN)) { + if (((uintptr_t)s & ALIGN) == ((uintptr_t)d & ALIGN)) { for (; ((uintptr_t)s & ALIGN) && n && (*d=*s); n--, s++, d++); if (n && *s) { wd=(void *)d; ws=(const void *)s; for (; n>=sizeof(size_t) && !HASZERO(*ws); - n-=sizeof(size_t), ws++, *wd++) *wd = *ws; + n-=sizeof(size_t), ws++, wd++) *wd = *ws; d=(void *)wd; s=(const void *)ws; } }