comparison src/util.c @ 8005:3bdfb4308d10

[gaim-migrate @ 8682] Fix an off-by-one in a malloc in gaim_quotedp_decode. Thanks shx :) committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 05 Jan 2004 07:08:32 +0000
parents 1b8261f374ea
children 17b90334f3cc
comparison
equal deleted inserted replaced
8004:07dc83303503 8005:3bdfb4308d10
250 void 250 void
251 gaim_quotedp_decode(const char *str, char **ret_str, int *ret_len) 251 gaim_quotedp_decode(const char *str, char **ret_str, int *ret_len)
252 { 252 {
253 char *p, *n, *new; 253 char *p, *n, *new;
254 254
255 n = new = g_malloc(strlen (str)); 255 n = new = g_malloc(strlen (str) + 1);
256 256
257 for (p = (char *)str; *p; p++, n++) { 257 for (p = (char *)str; *p; p++, n++) {
258 if (*p == '=') { 258 if (*p == '=') {
259 sscanf(p + 1, "%2x\n", (int *)n); 259 sscanf(p + 1, "%2x\n", (int *)n);
260 p += 2; 260 p += 2;