SQLite Android NDK Adds Custom Functions

I was able to get the SQLite installation using the NDK, but I can't get the custom features to work, which was the whole reason for SQLite injection using the NDK.

I used this library to get the same SQLite files. It also contains an extension file extensionfunctions.c , which adds to the string and math functions for SQLite.

From what I can see the SQLite implementation is working correctly, but I am unable to call any custom functions.

I don't know much about C / C ++, so any help would be great. Do I have to compile the extensionfunctions.c file myself and then add to the SO file with the libsqliteX.so file? Or do I need to make a call in android_database_SQLiteCommon.cpp to load in another extension? I don't know how it works.

Edit

The extensionfunctions.c file is included in the sqlite3secure.c file, which is located in the Android.mk file under LOCAL_SRC_FILES. I assume this means the file is being used correctly, but none of the custom functions are available.

Edit 2

// To enable the extension functions define SQLITE_ENABLE_EXTFUNC on compiling this module

#ifdef SQLITE_ENABLE_EXTFUNC
#define sqlite3_open    sqlite3_open_internal
#define sqlite3_open16  sqlite3_open16_internal
#define sqlite3_open_v2 sqlite3_open_v2_internal
#endif

#include "sqlite3.c"

#ifdef SQLITE_ENABLE_EXTFUNC
#undef sqlite3_open
#undef sqlite3_open16
#undef sqlite3_open_v2
#endif

      

I found the above code with a comment and I added it to the line below, but nothing seems to have changed.

#define SQLITE_ENABLE_EXTFUNC

      

Do I need to do anything for the application to be able to update its version of sqlite3 files or could this be a problem? My C skills are bad, so I guess I did what the comment says?

+3


source to share





All Articles