diff options
author | stephanie sappho lenzo <sappho@sappho.io> | 2024-01-04 04:32:24 -0500 |
---|---|---|
committer | stephanie sappho lenzo <sappho@sappho.io> | 2024-01-04 04:32:24 -0500 |
commit | 3b81c9e0446410d0577f10f87bf0cb27210f918b (patch) | |
tree | 8132a7dfa929a707c995c97c7a236769989417b4 /extension/natives.cpp | |
parent | 690df020dc670f140f1a8f3f2c0d87dfcaa16fb0 (diff) |
whack yet more old hash functions and also include windows build
Diffstat (limited to 'extension/natives.cpp')
-rw-r--r-- | extension/natives.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/extension/natives.cpp b/extension/natives.cpp index ef9c2fc..5715677 100644 --- a/extension/natives.cpp +++ b/extension/natives.cpp @@ -501,12 +501,13 @@ static cell_t sm_curl_hash_file(IPluginContext *pContext, const cell_t *params) char *filepath; pContext->LocalToString(params[1], &filepath); - int len = strlen(filepath); + size_t len = strlen(filepath); Openssl_Hash_pack *hash_pack = new Openssl_Hash_pack(); hash_pack->UserData = params[4]; - hash_pack->path = new char[len+1]; - strncpy(hash_pack->path, filepath, len); + hash_pack->path = new char[len+1]{}; + snprintf(hash_pack->path, len, "%s", filepath); + // strncpy(hash_pack->path, filepath, len); hash_pack->path[len] = '\0'; hash_pack->hash_callback = pFunction; @@ -523,9 +524,11 @@ static cell_t sm_curl_hash_string(IPluginContext *pContext, const cell_t *params Openssl_Hash hashType = (Openssl_Hash)params[3]; if ( - hashType == Openssl_Hash_MD2 - || hashType == Openssl_Hash_SHA - ) + hashType == Openssl_Hash_DEPRECATED_MD2_UNUSABLE + || hashType == Openssl_Hash_DEPRECATED_MD4_UNUSABLE + || hashType == Openssl_Hash_DEPRECATED_SHA_UNUSABLE + || hashType == Openssl_Hash_DEPRECATED_RIPEMD160_UNUSABLE + ) { return pContext->ThrowNativeError("Deprecated hash function %x - Sorry!", params[3]); } |