Skip to content

Commit 818c4d7

Browse files
committed
- strncpy returns the byte copied not error code or 0
1 parent 2cde8f4 commit 818c4d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/php_crypt_r.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
211211
strcat_s(passwd, MD5_HASH_MAX_LEN, "$");
212212
#else
213213
/* VC6 version doesn't have strcat_s or strncpy_s */
214-
if (strncpy(passwd + MD5_MAGIC_LEN, sp, sl + 1) != 0) {
214+
if (strncpy(passwd + MD5_MAGIC_LEN, sp, sl + 1) < sl) {
215215
goto _destroyCtx1;
216216
}
217217
strcat(passwd, "$");

0 commit comments

Comments
 (0)