Skip to content

OUTPUT *** buffer overflow detected *** because of output file name to be long #4

@Jemma1um

Description

@Jemma1um

When I ran mcluster with the following command, I got an error:
./mcluster -P1 -s0 -D1.0 -o 'mcluster_d1.0_N800_v1' -N 800

-----OUTPUT-----
*** buffer overflow detected ***: ./mcluster terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fb7239fa7e5]
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7fb723a9b56c]
/lib/x86_64-linux-gnu/libc.so.6(+0x116570)[0x7fb723a99570]
/lib/x86_64-linux-gnu/libc.so.6(+0x115ad9)[0x7fb723a98ad9]
/lib/x86_64-linux-gnu/libc.so.6(_IO_default_xsputn+0x80)[0x7fb7239fe6b0]
/lib/x86_64-linux-gnu/libc.so.6(_IO_vfprintf+0x139b)[0x7fb7239d150b]
/lib/x86_64-linux-gnu/libc.so.6(__vsprintf_chk+0x84)[0x7fb723a98b64]
/lib/x86_64-linux-gnu/libc.so.6(__sprintf_chk+0x7d)[0x7fb723a98abd]
...

I changed line 4792 of main.c, inside output3, from char tablefile[20] to char tablefile[50], to make sure that sprintf works well with long file names. Then I remake mcluster and it works.

Definitely, a shorter name can simply avoid this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions