Skip to content
Snippets Groups Projects
Commit 33c90c56 authored by deuce's avatar deuce
Browse files

Allocate the line buffer to be the same size as the input buffer. There is

no real limit to the number of characters in a logical line since an
infinite number of ^A codes can be included.  Someone (Angus) has put
messages in the wild with a line containing more ^A code bytes than data
bytes.  :-)
parent b5eb48d9
Branches
Tags
No related merge requests found
......@@ -183,17 +183,18 @@ char* wordwrap(char* inbuf, int len, int oldlen, BOOL handle_quotes)
int quote_count=0;
int old_prefix_bytes=0;
int outbuf_size=0;
int inbuf_len=strlen(inbuf);
outbuf_size=strlen(inbuf)*3+1;
outbuf_size=inbuf_len*3+1;
if((outbuf=(char*)malloc(outbuf_size))==NULL)
return NULL;
outp=outbuf;
if((linebuf=(char*)malloc((len*2)+2))==NULL) /* room for ^A codes ToDo: This isn't actually "enough" room */
if((linebuf=(char*)malloc(inbuf_len+1))==NULL) /* room for ^A codes */
return NULL;
if(handle_quotes) {
if((prefix=(char *)malloc((len*2)+2))==NULL) { /* room for ^A codes ToDo: This isn't actually "enough" room */
if((prefix=(char *)malloc(inbuf_len+1))==NULL) { /* room for ^A codes */
free(linebuf);
return NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment