c/2637: string copy problem
markus@colorplaza.com
markus@colorplaza.com
Wed Apr 25 06:56:00 GMT 2001
>Number: 2637
>Category: c
>Synopsis: string copy problem
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 25 06:56:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: M. Virtanen
>Release: gcc 2.95.3
>Organization:
>Environment:
RH Linux 6.2, glibc-2.1.22
>Description:
Following tiny example program causes seg fault.
>How-To-Repeat:
compile and execute the code.
>Fix:
If I define the string as following:
char test[40];
strcpy(test, "4444 2222 7777 8888");
it works.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="eatw.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="eatw.c"
I2luY2x1ZGUgPHN0ZGlvLmg+CgovKgogKiAgdGhpcyBmdW5jdGlvbiB0YWtlbiBmcm9tIEsmUiAy
bmQgZWQuIHAuIDQ3CiovCnZvaWQgc3F1ZWV6ZShjaGFyIHNbXSwgY2hhciBjKQp7CglpbnQgaT0w
LCBqPTA7CgkKCWZvciAoaT1qPTA7IHNbaV0gIT0gJ1wwJzsgaSsrKQoJCWlmIChzW2ldICE9IGMp
CgkJCXNbaisrXSA9IHNbaV07CglzW2pdID0gJ1wwJzsJCn0KCmludCBtYWluKHZvaWQpCnsKCWNo
YXIgKnRlc3QgPSAiNDQ0NCAyMjIyIDc3NzcgODg4OCI7CgkKCXByaW50ZigiT3JpZ2luYWwgc3Ry
aW5nOiAlc1xuIiwgdGVzdCk7CgkJCglzcXVlZXplKHRlc3QsICcgJyk7CgkKCXByaW50ZigiU3F1
ZWV6ZWQgc3RyaW5nOiAlc1xuIiwgdGVzdCk7CgkKCXJldHVybiAwOwp9Cg==
More information about the Gcc-prs
mailing list