comparison archive/readpst.c.diff @ 57:de3753c3160a

add archive directory with history of alioth versions that have been merged here
author Carl Byington <carl@five-ten-sg.com>
date Sat, 02 Feb 2008 12:54:07 -0800
parents
children
comparison
equal deleted inserted replaced
56:b504411ad213 57:de3753c3160a
1 Index: readpst.c
2 ===================================================================
3 --- readpst.c (revision 45)
4 +++ readpst.c (working copy)
5 @@ -1396,6 +1396,7 @@
6 // char *rfc2426_escape(char *str) {{{1
7 char *rfc2426_escape(char *str) {
8 static char *buf = NULL;
9 + static int buflen = 0;
10 char *a, *b;
11 int x, y, z;
12 DEBUG_ENT("rfc2426_escape");
13 @@ -1411,9 +1412,10 @@
14 z = chr_count(str, '\r');
15 x = strlen(str) + y - z;
16
17 - if ( (y - z) == 0 ) // resize buffer if needed
18 + if ( x + 1 > buflen ) // resize buffer if needed
19 {
20 buf = (char*) realloc(buf, x + 1); // don't forget room for the NUL
21 + buflen = x + 1;
22 if ( buf == NULL )
23 {
24 fprintf(stderr, "Error: rfc2426_escape(): realloc(%d) returned NULL!\n", x + 1);