From 4f5715d260e26a121ff8df816be8320c0b7a6a9c Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 20 Aug 2008 13:31:30 +0000 Subject: [PATCH] - MFB: strncpy returns the byte copied not error code or 0 --- ext/standard/php_crypt_r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c index 99042b01a9..5e5904b07c 100644 --- a/ext/standard/php_crypt_r.c +++ b/ext/standard/php_crypt_r.c @@ -211,7 +211,7 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) { strcat_s(passwd, MD5_HASH_MAX_LEN, "$"); #else /* VC6 version doesn't have strcat_s or strncpy_s */ - if (strncpy(passwd + MD5_MAGIC_LEN, sp, sl + 1) != 0) { + if (strncpy(passwd + MD5_MAGIC_LEN, sp, sl + 1) < sl) { goto _destroyCtx1; } strcat(passwd, "$"); -- 2.50.1