]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Avoid using insecure sqlite3_enable_load_extension when SQLITE_DBCONFIG_ENABLE... 1658/head
authorAndrey Volk <andywolk@gmail.com>
Wed, 18 May 2022 20:45:00 +0000 (23:45 +0300)
committerAndrey Volk <andywolk@gmail.com>
Wed, 18 May 2022 20:54:01 +0000 (23:54 +0300)
src/switch_core_db.c

index d3701ce91f4cc74f4ac381accc13c119c416d5e3..afda66af62e6f0cdbadc648cd6b43251a2e24ba0 100644 (file)
@@ -181,9 +181,14 @@ SWITCH_DECLARE(int) switch_core_db_load_extension(switch_core_db_t *db, const ch
        int ret = 0;
        char *err = NULL;
 
+#ifdef SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
+       sqlite3_db_config(db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, 0);
+       ret = sqlite3_load_extension(db, extension, 0, &err);
+#else
        sqlite3_enable_load_extension(db, 1);
        ret = sqlite3_load_extension(db, extension, 0, &err);
        sqlite3_enable_load_extension(db, 0);
+#endif
 
        if (err) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LOAD EXTENSION ERR [%s]\n", err);