Skip to content
Snippets Groups Projects
Commit 3da89611 authored by rswindell's avatar rswindell
Browse files

Fix the off-by-one error in the COLS kludge line parsing logic.

Don't store a columns value of 0 (the default).
Use SAFEPRINTF in place of sprintf() in parse_control_line().
parent 3a1923d8
No related branches found
No related tags found
No related merge requests found
......@@ -177,7 +177,7 @@ char* parse_control_line(const char* fmsgbuf, const char* kludge)
if(fmsgbuf == NULL)
return NULL;
sprintf(str, "\1%s", kludge);
SAFEPRINTF(str, "\1%s", kludge);
p = strstr(fmsgbuf, str);
if(p == NULL)
return NULL;
......@@ -3474,11 +3474,12 @@ int fmsgtosmsg(char* fbuf, fmsghdr_t* hdr, uint user, uint subnum)
msg.hdr.when_written.zone = fmsgzone(fbuf+l);
}
else if(!strncmp((char *)fbuf+l+1,"COLS:", 5)) { /* SBBSecho */
l+=5;
else if(!strncmp((char *)fbuf + l + 1, "COLS:", 5)) { /* SBBSecho */
l += 6;
while(l<length && fbuf[l] <= ' ' && fbuf[l] >= 0) l++;
uint8_t columns = atoi(fbuf + l);
smb_hfield_bin(&msg, SMB_COLUMNS, columns);
if(columns > 0)
smb_hfield_bin(&msg, SMB_COLUMNS, columns);
}
else { /* Unknown kludge line */
......
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