]> granicus.if.org Git - php/commitdiff
- strncpy returns the byte copied not error code or 0
authorPierre Joye <pajoye@php.net>
Wed, 20 Aug 2008 13:27:10 +0000 (13:27 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 20 Aug 2008 13:27:10 +0000 (13:27 +0000)
ext/standard/php_crypt_r.c

index 6f8f6d7a8078336cbaefb492f5f37893654aa841..bc4fbf3fc44903dbefddcc9baef2b6e9ede768d9 100644 (file)
@@ -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, "$");