Skip to content
Snippets Groups Projects
Commit 1111fb24 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Allow SAFECAT to work on uchar arrays

Caught by CID 331001

The use of SAFECAT() with a typecast to a pointer is not going to work as expected. This change broke line-based telnet-gateway functionality (unconfirmed, but pretty obvious).
parent a1f9abb7
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1851 failed
...@@ -191,7 +191,7 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode, char* client_user_name, cha ...@@ -191,7 +191,7 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode, char* client_user_name, cha
rd=getstr((char*)buf,sizeof(buf)-1,l); rd=getstr((char*)buf,sizeof(buf)-1,l);
if(!rd) if(!rd)
continue; continue;
SAFECAT((char*)buf,crlf); SAFECAT(buf,crlf);
rd+=2; rd+=2;
gotline=true; gotline=true;
} }
......
...@@ -427,8 +427,8 @@ typedef struct { ...@@ -427,8 +427,8 @@ typedef struct {
#endif #endif
#define SAFECAT(dst, src) do { \ #define SAFECAT(dst, src) do { \
if(strlen(dst) + strlen(src) < sizeof(dst)) { \ if(strlen((char*)(dst)) + strlen((char*)(src)) < sizeof(dst)) { \
strcat(dst, src); \ strcat((char*)(dst), (char*)(src)); \
} \ } \
} while(0) } while(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment