ALT Linux Bugzilla
– Attachment 4061 Details for
Bug 20977
Buffer overflow on volume access
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
Reduced testcase
1.c (text/plain), 557 bytes, created by
Kirill A. Shutemov
on 2009-11-14 03:33:44 MSK
(
hide
)
Description:
Reduced testcase
Filename:
MIME Type:
Creator:
Kirill A. Shutemov
Created:
2009-11-14 03:33:44 MSK
Size:
557 bytes
patch
obsolete
>#include <stdlib.h> >#include <string.h> >#include <stdio.h> > >struct test { > char a1[0]; > char a2[0]; >} __attribute__ ((__packed__)); > >int main(int argc, char **argv) >{ > struct test *test; > int len1, len2; > > if (argc < 3) > return 1; > > len1 = strlen(argv[1]) + 1; > len2 = strlen(argv[2]) + 1; > > test = malloc(sizeof(*test) + len1 + len2); > >#if 1 > strcpy(test->a1, argv[1]); > strcpy(test->a2 + len1, argv[2]); >#else > memcpy(test->a1, argv[1], len1); > memcpy(test->a2 + len1, argv[2], len2); >#endif > > printf("%s:%s\n", test->a1, test->a2 + len1); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 20977
: 4061