From 57aacb7f43e0e1a1739fa5b3f783f7a6f7a61e8b Mon Sep 17 00:00:00 2001 From: deuce <> Date: Fri, 23 Jan 2009 07:20:30 +0000 Subject: [PATCH] Add a pair of doublequotes after every hex character... this is to avoid implementation defind behaviour with more than two byte hex codes... ie: "\x01b" may legally be interpreted as "\x1b" or "\x01""b" --- src/sbbs3/textgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sbbs3/textgen.c b/src/sbbs3/textgen.c index f7d540e2b3..a7f84f9b4b 100644 --- a/src/sbbs3/textgen.c +++ b/src/sbbs3/textgen.c @@ -153,8 +153,8 @@ char *format_as_cstr(char *orig) if(!orig) return(NULL); for(in=orig; *in; in++) { - if(outpos >= len-5) { - len += strlen(in)+5; + if(outpos >= len-7) { + len += strlen(in)+7; tmp=realloc(ret, len); if(tmp==NULL) { free(ret); @@ -168,6 +168,8 @@ char *format_as_cstr(char *orig) ret[outpos++]='x'; ret[outpos++]=hex[0]; ret[outpos++]=hex[1]; + ret[outpos++]='"'; + ret[outpos++]='"'; } else ret[outpos++]=*in; -- GitLab