Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buffer overflow detected ***: dup201 terminated #570

Closed
CentUser opened this issue Sep 10, 2019 · 5 comments
Closed

buffer overflow detected ***: dup201 terminated #570

CentUser opened this issue Sep 10, 2019 · 5 comments

Comments

@CentUser
Copy link
Contributor

*** buffer overflow detected ***: dup201 terminated
======= Backtrace: =========
/lib64/libc.so.6(__fortify_fail+0x37)[0x7f8c53da5047]
/lib64/libc.so.6(+0x10d200)[0x7f8c53da3200]
/lib64/libc.so.6(+0x10c709)[0x7f8c53da2709]
/lib64/libc.so.6(_IO_default_xsputn+0xbc)[0x7f8c53d0e60c]
/lib64/libc.so.6(_IO_vfprintf+0xb0d)[0x7f8c53cddc3d]
/lib64/libc.so.6(__vsprintf_chk+0x88)[0x7f8c53da2798]
/lib64/libc.so.6(__sprintf_chk+0x7d)[0x7f8c53da26ed]
dup201[0x402d45]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f8c53cb7b35]
dup201[0x402e17]
======= Memory map: ========
00400000-00417000 r-xp 00000000 fd:00 141330 /opt/ltp/testcases/bin/dup201
00616000-00617000 r--p 00016000 fd:00 141330 /opt/ltp/testcases/bin/dup201
00617000-00618000 rw-p 00017000 fd:00 141330 /opt/ltp/testcases/bin/dup201
00618000-0061b000 rw-p 00000000 00:00 0
020f6000-02117000 rw-p 00000000 00:00 0 [heap]
7f8c53a80000-7f8c53a95000 r-xp 00000000 fd:00 920974 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f8c53a95000-7f8c53c94000 ---p 00015000 fd:00 920974 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f8c53c94000-7f8c53c95000 r--p 00014000 fd:00 920974 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f8c53c95000-7f8c53c96000 rw-p 00015000 fd:00 920974 /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7f8c53c96000-7f8c53e4c000 r-xp 00000000 fd:00 920779 /usr/lib64/libc-2.17.so
7f8c53e4c000-7f8c5404c000 ---p 001b6000 fd:00 920779 /usr/lib64/libc-2.17.so
7f8c5404c000-7f8c54050000 r--p 001b6000 fd:00 920779 /usr/lib64/libc-2.17.so
7f8c54050000-7f8c54052000 rw-p 001ba000 fd:00 920779 /usr/lib64/libc-2.17.so
7f8c54052000-7f8c54057000 rw-p 00000000 00:00 0
7f8c54057000-7f8c54077000 r-xp 00000000 fd:00 924041 /usr/lib64/ld-2.17.so
7f8c54265000-7f8c54268000 rw-p 00000000 00:00 0
7f8c54273000-7f8c54276000 rw-p 00000000 00:00 0
7f8c54276000-7f8c54277000 r--p 0001f000 fd:00 924041 /usr/lib64/ld-2.17.so
7f8c54277000-7f8c54278000 rw-p 00020000 fd:00 924041 /usr/lib64/ld-2.17.so
7f8c54278000-7f8c54279000 rw-p 00000000 00:00 0
7ffe4d8f6000-7ffe4d917000 rw-p 00000000 00:00 0 [stack]
7ffe4d9b3000-7ffe4d9b5000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

Seems like this storage is not sufficient. And the programme crashed.

I changed this to 40, then

sprintf(fname, "dup201.%d.%d", j, mypid);

error in this line goes away.

@metan-ucw
Copy link
Member

Actually the test seems to be in great mess, we can remove the whole loop that does sprintf() because it does nothing, it looks like a leftover. Will you send a patch or should I do so?

@CentUser
Copy link
Contributor Author

I think we should also remove all these unused varibles。
So, in the patch, I did it.

ltp_patch.txt

@CentUser
Copy link
Contributor Author

I recompiled the project after I applied this patch. It could be built successfully.

@metan-ucw
Copy link
Member

Can you please send this patch to the LTP mailing list for a proper review?

@CentUser
Copy link
Contributor Author

OK,Email sent, yet awaiting for moderator's approval...

jcronenberg pushed a commit to jcronenberg/ltp that referenced this issue Nov 22, 2019
The code that fills the string in a loop and calls unlink() does not
actually do anything and seems to be leftover, hence we delete it along
with unused variables.

Fixes: linux-test-project#570

Signed-off-by: Wu,Haiqiang <frequentemail@126.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
jcronenberg pushed a commit to jcronenberg/ltp that referenced this issue Nov 26, 2019
The code that fills the string in a loop and calls unlink() does not
actually do anything and seems to be leftover, hence we delete it along
with unused variables.

Fixes: linux-test-project#570

Signed-off-by: Wu,Haiqiang <frequentemail@126.com>
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants