From: Pierre Joye Date: Wed, 20 Aug 2008 13:31:30 +0000 (+0000) Subject: - MFB: strncpy returns the byte copied not error code or 0 X-Git-Tag: BEFORE_HEAD_NS_CHANGE~643 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f5715d260e26a121ff8df816be8320c0b7a6a9c;p=php - MFB: strncpy returns the byte copied not error code or 0 --- 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, "$");