misc/125523: [libc] strcpy(3) buffer overflow

Dmitry Andrianov 666.root at gmail.com
Fri Jul 11 22:10:02 UTC 2008


>Number:         125523
>Category:       misc
>Synopsis:       [libc] strcpy(3) buffer overflow
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 11 22:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Andrianov
>Release:        7.0
>Organization:
79.120.123.5
>Environment:
FreeBSD zingel.dubki.ru 7.0-RELEASE-p2 FreeBSD 7.0-RELEASE-p2 #4: Thu Jul 10 07:17:09 EEST 2008     beastie at zingel.dubki.ru:/usr/obj/usr/src/sys/BEASTIE  i386
>Description:
Hello.

I found out an error, at the use of the following code:


--
			#include <stdio.h>
			#include <stdlib.h>
			#include <unistd.h>

			int foobar(int x, char *str) {
				char buf[256];
				strcpy(buf, str);
				return x;
			}

			int main(int argc, char **argv) {
				foobar(64, argv[1]);
				return 1;
			}			
--

error message:

[root at zingel ~/test]# gcc -o strcpy  strcpy.c
[root at zingel ~/test]# ./strcpy
Segmentation fault: 11 (core dumped)
[root at zingel ~/test]# gdb -tui strcpy
..
(gdb) r
Starting program: /root/test/strcpy
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x2814533a in strcpy () from /lib/libc.so.7

--


Check, please.

Thank You.
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list