1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Added the test program for the sprintf() buffer flush bug, courtesy of

Jens Langner.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14725 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2004-09-10 07:41:13 +00:00
parent 6214bc2067
commit 6a2db55fc2
3 changed files with 40 additions and 6 deletions

View File

@ -0,0 +1,25 @@
#include <string.h>
#include <stdio.h>
static char buf[256];
void addsomething(void)
{
char *p = &buf[strlen(buf)];
sprintf(p, "yeah");
}
int main(void)
{
buf[0] = '\0';
addsomething();
printf("1: [%s]\n", buf);
sprintf(buf, "");
addsomething();
printf("2: [%s]\n", buf);
return (0);
}