Преглед изворни кода

fix alignment logic in strlcpy

Rich Felker пре 12 година
родитељ
комит
820fccdefe
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      src/string/strlcpy.c

+ 1 - 1
src/string/strlcpy.c

@@ -16,7 +16,7 @@ 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;