eggheads / eggdrop

The Eggdrop IRC Bot
GNU General Public License v2.0
510 stars 84 forks source link

Fix strcpy-param-overlap #1548

Closed michaelortmann closed 7 months ago

michaelortmann commented 8 months ago

Found by: michaelortmann Patch by: michaelortmann Fixes: #1111

One-line summary: Fix strcpy-param-overlap

Additional description (if needed): If your distribution or you compile with CFLAGS -fsanitize=address eggdrop could abort-crash

Test cases demonstrating functionality (if applicable): compiled eggdrop with -fsanitize=address, run it, load filesys mod (default), issue command .files then ls.

$ ./eggdrop -t BotB.conf
[...]
.files
[...]
ls
=================================================================
==666518==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7829b7b39170,0x7829b7b39173) and [0x7829b7b39170, 0x7829b7b39173) overlap
    #0 0x7829ba8a8be8 in __interceptor_strcpy /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:438
    #1 0x7829b54ba1da in dcc_files .././filesys.mod/filesys.c:232
[...]
==666518==ABORTING
$
[...]
ls
=================================================================
==731401==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7bb2a5339170,0x7bb2a5339173) and [0x7bb2a5339170, 0x7bb2a5339173) overlap
    #0 0x7bb2a82a8be8 in __interceptor_strcpy /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:438
    #1 0x7bb2a2cb9a49 in got_files_cmd .././filesys.mod/filesys.c:217
[...]
==731401==ABORTING
$