udan11 / samp-plugin-sql

An abstract layer that communicates with multiple database servers (MySQL and PostgreSQL) implemented as a plugin for SA-MP servers.
BSD 2-Clause "Simplified" License
16 stars 13 forks source link

sql_escape_string crash #4

Closed dimaz1k closed 11 years ago

dimaz1k commented 11 years ago

[16:20:08] [debug] Server crashed while executing public.amx [16:20:08] [debug] AMX backtrace: [16:20:08] [debug] #0 native sql_escape_string () [f74e1650] from sql.so [16:20:08] [debug] #1 000de350 in ?? (0x00000000, 0x00826070) from public.amx [16:20:08] [debug] #2 00088a0c in public OnDialogResponse (0x00000000, 0x0000006c, 0x00000001, 0xffffffff, 0x00826070) from public.amx [16:20:08] [debug] Native backtrace: [16:20:08] [debug] #0 f712a60b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so [16:20:08] [debug] #1 f7121e92 in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so [16:20:08] [debug] #2 f71238d9 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so [16:20:08] [debug] #3 f712a2a0 in ?? () from plugins/crashdetect.so [16:20:08] [debug] #4 f77a4410 in ?? () [16:20:08] [debug] #5 f756fe8f in ?? () from /lib32/libc.so.6 [16:20:08] [debug] #6 f753cb0f in _IO_vfprintf () from /lib32/libc.so.6 [16:20:08] [debug] #7 f755caa0 in vsnprintf () from /lib32/libc.so.6 [16:20:08] [debug] #8 f74de7e4 in _Z3logiPcz () from plugins/sql.so [16:20:08] [debug] #9 f74e1726 in _ZN7Natives17sql_escape_stringEP6tagAMXPi () from plugins/sql.so [16:20:08] [debug] #10 08093c94 in ?? () from ./samp03svr [16:20:08] [debug] #11 f71215fc in ZN11CrashDetect13DoAmxCallbackEiPiS0 () from plugins/crashdetect.so [16:20:08] [debug] #12 f712615c in ?? () from plugins/crashdetect.so [16:20:08] [debug] #13 f712e64d in amx_Exec () from plugins/crashdetect.so [16:20:08] [debug] #14 f7123abb in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so [16:20:08] [debug] #15 f7126100 in ?? () from plugins/crashdetect.so [16:20:08] [debug] #16 080ae33f in ?? () from ./samp03svr [16:20:08] [debug] #17 080b97da in ?? () from ./samp03svr [16:20:08] [debug] #18 08071ae8 in ?? () from ./samp03svr [16:20:08] [debug] #19 08071be2 in ?? () from ./samp03svr [16:20:08] [debug] #20 0807ba00 in ?? () from ./samp03svr [16:20:08] [debug] #21 080b59ad in ?? () from ./samp03svr [16:20:08] [debug] #22 080b5b42 in ?? () from ./samp03svr [16:20:08] [debug] #23 080b1453 in ?? () from ./samp03svr [16:20:08] [debug] #24 f7512ca6 in __libc_start_main () from /lib32/libc.so.6 [16:20:08] [debug] #25 0804b521 in ?? () from ./samp03svr

udan11 commented 11 years ago

Can you give me more details about the string you are trying to escape? Does it crash randomly?

It looks like it crashes only if the string is null.

dimaz1k commented 11 years ago

inputtext = "233";

CheckPassword(0, inputtext );

CheckPassword(playerid, password[]) { sql_escape_string(MySQL_ACCOUNTS, password, password, strlen(password)+1); ... }

udan11 commented 11 years ago

I have fixed it. I'll push the update soon.

EDIT: Fixed in 270669367e / version 2.1.