aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-11-29 18:26:09 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-11-29 18:26:09 +0000
commitc073625fb905b41703589f2af5e4039db19746f7 (patch)
tree7e232e33d8afb487d0fe75b1e9e560494178df14
parent85dd4bfb8d513d7053a327031d6e41038037cad2 (diff)
zero terminate the buffer spitout() returns, as the sws.c code depends on
that!
-rw-r--r--tests/server/getpart.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/server/getpart.c b/tests/server/getpart.c
index 0ae6c391c..a544c517b 100644
--- a/tests/server/getpart.c
+++ b/tests/server/getpart.c
@@ -58,14 +58,14 @@ char *appendstring(char *string, /* original string */
char base64) /* 1 if base64 encoded */
{
size_t len = strlen(buffer);
- size_t needed_len = len + *stringlen;
+ size_t needed_len = len + *stringlen + 1;
char buf64[256]; /* big enough? */
if(base64) {
/* decode the given buffer first */
len = Curl_base64_decode(buffer, buf64); /* updated len */
buffer = buf64;
- needed_len = len + *stringlen; /* recalculate */
+ needed_len = len + *stringlen + 1; /* recalculate */
}
if(needed_len >= *stralloc) {
@@ -83,6 +83,7 @@ char *appendstring(char *string, /* original string */
/* memcpy to support binary blobs */
memcpy(&string[*stringlen], buffer, len);
*stringlen += len;
+ string[*stringlen]=0;
return string;
}
@@ -217,8 +218,10 @@ int main(int argc, char **argv)
}
else {
size_t size;
+ unsigned int i;
const char *buffer = spitout(stdin, argv[1], argv[2], &size);
- printf("%s", buffer);
+ for(i=0; i< size; i++)
+ printf("%c", buffer[i]);
}
return 0;
}