Skip to content
Snippets Groups Projects
Commit 57aacb7f authored by deuce's avatar deuce
Browse files

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"
parent 95e12a3d
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment