summaryrefslogtreecommitdiff
path: root/ext/standard/php_crypt_r.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2008-08-20 13:27:10 +0000
committerPierre Joye <pajoye@php.net>2008-08-20 13:27:10 +0000
commit818c4d75c8ca91c6d8dc30667ff06b101e02cd2b (patch)
tree2f364972b8338c846effea6ce6bdb453d4f05839 /ext/standard/php_crypt_r.c
parent2cde8f416ac260d1d701a3c7e6d4dbb0ede46198 (diff)
downloadphp-git-818c4d75c8ca91c6d8dc30667ff06b101e02cd2b.tar.gz
- strncpy returns the byte copied not error code or 0
Diffstat (limited to 'ext/standard/php_crypt_r.c')
-rw-r--r--ext/standard/php_crypt_r.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c
index 6f8f6d7a80..bc4fbf3fc4 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, "$");