]> granicus.if.org Git - php/commitdiff
Use reantrant crypt_r() whenever possible.
authorIlia Alshanetsky <iliaa@php.net>
Thu, 30 Nov 2006 15:59:53 +0000 (15:59 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 30 Nov 2006 15:59:53 +0000 (15:59 +0000)
ext/standard/crypt.c

index b147f88b0f2893e8fa5b8f7d3c092499d575092f..9b06de807078655f3b87ddbabeec694915c09d76 100644 (file)
@@ -145,8 +145,15 @@ PHP_FUNCTION(crypt)
                salt[2] = '\0';
 #endif
        }
-
-       RETVAL_STRING(crypt(str, salt), 1);
+#ifdef HAVE_CRYPT_R
+       {
+               struct crypt_data buffer;
+               memset(&buffer, 0, sizeof(buffer));
+               RETURN_STRING(crypt_r(str, salt, &buffer));
+       }
+#else
+       RETURN_STRING(crypt(str, salt), 1);
+#endif
 }
 /* }}} */
 #endif