diff --git a/Source/NSData.m b/Source/NSData.m index 2f936868b..9f98de44c 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -1133,7 +1133,7 @@ failure: { searchRange.length = countOther; } - if (memcmp(&bytesSelf[searchRange.location], &bytesOther[0], + if (memcmp(bytesSelf + searchRange.location, bytesOther, countOther) == 0) { result = searchRange; @@ -1165,7 +1165,8 @@ failure: { while (pos-- > 0) { - if (memcmp(&bytesSelf[searchRange.location + pos], bytesOther, countOther) == 0) + if (memcmp(bytesSelf + searchRange.location + pos, + bytesOther, countOther) == 0) { break; } @@ -1175,7 +1176,8 @@ failure: { while (pos < end) { - if (memcmp(&bytesSelf[searchRange.location + pos], bytesOther, countOther) == 0) + if (memcmp(bytesSelf + searchRange.location + pos, + bytesOther, countOther) == 0) { break; } @@ -1981,8 +1983,8 @@ failure: int desc; int mask; - strncpy(thePath, theRealPath, sizeof(thePath) - 1); - thePath[sizeof(thePath) - 1] = '\0'; + strncpy(thePath, theRealPath, sizeof(thePath) - 7); + thePath[sizeof(thePath) - 7] = '\0'; strncat(thePath, "XXXXXX", 6); if ((desc = mkstemp(thePath)) < 0) {