Mercurial > pidgin.yaz
changeset 9940:77a9f7e5516c
[gaim-migrate @ 10832]
datallah thinks we should prevent this possible trouble with long logfile names
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 02 Sep 2004 19:45:15 +0000 |
parents | acbbc0d73600 |
children | 426b623ffe16 |
files | src/util.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/util.c Thu Sep 02 19:01:33 2004 +0000 +++ b/src/util.c Thu Sep 02 19:45:15 2004 +0000 @@ -2883,10 +2883,12 @@ g_return_val_if_fail(str != NULL, NULL); - for (i = 0; i < strlen(str); i++) { + for (i = 0; i < strlen(str) && j < (BUF_LEN - 1); i++) { if (isalnum(str[i])) buf[j++] = str[i]; else { + if (j > (BUF_LEN - 4)) + break; sprintf(buf + j, "%%%02x", (unsigned char)str[i]); j += 3; } @@ -3219,11 +3221,13 @@ g_return_val_if_fail(str != NULL, NULL); - for (i = 0; i < strlen(str); i++) { + for (i = 0; i < strlen(str) && j < (BUF_LEN - 1); i++) { if (isalnum(str[i]) || str[i] == '@' || str[i] == '-' || str[i] == '_' || str[i] == '.' || str[i] == '#') buf[j++] = str[i]; else { + if (j > (BUF_LEN - 4)) + break; sprintf(buf + j, "%%%02x", (unsigned char)str[i]); j += 3; }