Fixed too low malloc in clencode function

This commit is contained in:
Michiel Broek
2007-02-26 21:02:30 +00:00
parent f69200f40f
commit 0919143543
6 changed files with 12 additions and 11 deletions

View File

@@ -383,7 +383,7 @@ void chartran_close(void)
*/
char *chartran(char *input)
{
static char outbuf[1024];
static char outbuf[4096];
static char temp[4096];
size_t rc, inSize, outSize;
char *in, *out;

View File

@@ -525,12 +525,12 @@ char *clencode(char *s)
if (s == NULL)
return NULL;
if ((buf = malloc(2 * strlen(s) + 1 * sizeof(char))) == NULL) {
if ((buf = malloc(3 * strlen(s) + 1 * sizeof(char))) == NULL) {
Syslog('+', "clencode: out of memory:string too long:\"%s\"", s);
return s;
}
for (p = s, q = buf; *p != '\0';) {
if ((! isascii(*p)) || (*p == ',') || (*p == ';') || (*p == '"')) {
if (( ! isascii(*p)) || (*p == '%') || (*p == ',') || (*p == ';') || (*p == '"')) {
*q++ = '\\';
*q++ = Base16Code[(*p >> 4) & 0x0f];
*q++ = Base16Code[*p & 0x0f];

View File

@@ -24,7 +24,7 @@ int tracing = TRUE; /* Trace macro evalution */
/* Local variables. */
#define MAXARGS 10 /* Maximum arguments to a macro */
#define MAXSTR 4096 /* Maximum string length */ /* Was 2560 */
#define MAXSTR 19200 /* Maximum string length */ /* Was 2560 */ /* Size full UTF-8 code filesdesc */
#define MAXDEPTH 32 /* Maximum recursion depth for eval */
#define MACROCHAR '@' /* Macro trigger character */