summaryrefslogtreecommitdiff
path: root/ext/standard/php_crypt_r.c
diff options
context:
space:
mode:
authorElizabeth Marie Smith <auroraeosrose@php.net>2008-07-28 16:43:51 +0000
committerElizabeth Marie Smith <auroraeosrose@php.net>2008-07-28 16:43:51 +0000
commit49aa0feaae87434c2dee0979f30ca1d0496ae989 (patch)
tree96334be3eb1ee0c4ed00aaad3c73ab166aede5f8 /ext/standard/php_crypt_r.c
parentd4b0beb322aa0b09633e6761ffdf40c5edbc04df (diff)
downloadphp-git-49aa0feaae87434c2dee0979f30ca1d0496ae989.tar.gz
Secure versions of string functions don't exist for VC6
Diffstat (limited to 'ext/standard/php_crypt_r.c')
-rw-r--r--ext/standard/php_crypt_r.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/standard/php_crypt_r.c b/ext/standard/php_crypt_r.c
index 6efce8b8f3..fffd96a048 100644
--- a/ext/standard/php_crypt_r.c
+++ b/ext/standard/php_crypt_r.c
@@ -204,11 +204,18 @@ char * php_md5_crypt_r(const char *pw, const char *salt, char *out) {
memcpy(passwd, MD5_MAGIC, MD5_MAGIC_LEN);
+#ifdef strncpy_s
if (strncpy_s(passwd + MD5_MAGIC_LEN, MD5_HASH_MAX_LEN - MD5_MAGIC_LEN, sp, sl + 1) != 0) {
goto _destroyCtx1;
}
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) {
+ goto _destroyCtx1;
+ }
+ strcat(passwd, "$");
+#endif
dwHashLen = 16;
/* Fetch the ctx hash value */