Fix CVE-2010-0742
[oweals/openssl.git] / crypto / mem_dbg.c
index 8316485217ac48847f59ce5ce8a51ba86df2ff97..dfeb08479931bcb434a95f4e27234e564a6ee5da 100644 (file)
@@ -330,7 +330,7 @@ static APP_INFO *pop_info(void)
        return(ret);
        }
 
-int CRYPTO_push_info_(const char *info, const char *file, int line)
+int CRYPTO_dbg_push_info(const char *info, const char *file, int line)
        {
        APP_INFO *ami, *amim;
        int ret=0;
@@ -380,7 +380,7 @@ int CRYPTO_push_info_(const char *info, const char *file, int line)
        return(ret);
        }
 
-int CRYPTO_pop_info(void)
+int CRYPTO_dbg_pop_info(void)
        {
        int ret=0;
 
@@ -395,7 +395,7 @@ int CRYPTO_pop_info(void)
        return(ret);
        }
 
-int CRYPTO_remove_all_info(void)
+int CRYPTO_dbg_remove_all_info(void)
        {
        int ret=0;
 
@@ -793,3 +793,25 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb)
        lh_doall_arg(mh, LHASH_DOALL_ARG_FN(cb_leak), &cb);
        CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2);
        }
+
+void CRYPTO_malloc_debug_init(void)
+       {
+       CRYPTO_set_mem_debug_functions(
+               CRYPTO_dbg_malloc,
+               CRYPTO_dbg_realloc,
+               CRYPTO_dbg_free,
+               CRYPTO_dbg_set_options,
+               CRYPTO_dbg_get_options);
+       CRYPTO_set_mem_info_functions(
+               CRYPTO_dbg_push_info,
+               CRYPTO_dbg_pop_info,
+               CRYPTO_dbg_remove_all_info);
+       }
+
+char *CRYPTO_strdup(const char *str, const char *file, int line)
+       {
+       char *ret = CRYPTO_malloc(strlen(str)+1, file, line);
+
+       strcpy(ret, str);
+       return ret;
+       }