annotate src/testdebug.c @ 42:7a97f50c39c5 stable-0-5-12 **FUNKY**

security fix for potential buffer overrun in lz decompress
author carl
date Tue, 02 Oct 2007 16:10:36 -0700
parents c508ee15dfca
children f66078abed38
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
1 #include <stdlib.h>
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
2 #include <string.h>
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
3 #include "define.h"
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
4
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
5 #define BUF_SIZE 100000
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
6 int main() {
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
7 char *x = xmalloc(BUF_SIZE); // 10k
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
8 memset(x, '.', BUF_SIZE-1);
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
9 x[BUF_SIZE-2]='P';
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
10 x[BUF_SIZE-1]='\0';
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
11
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
12 DEBUG_INIT("libpst.log");
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
13 DEBUG_REGISTER_CLOSE();
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
14
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
15 DEBUG_ENT("main");
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
16
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
17 DEBUG_FILE(("%s", x));
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
18 DEBUG_FILE(("This is an error %d\n", 4));
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
19
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
20 DEBUG_RET();
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
21 return 0;
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
22 }
c508ee15dfca switch to automake/autoconf
carl
parents:
diff changeset
23