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

Function-like-ify SAFECAT()

parent 33adbf53
No related branches found
No related tags found
No related merge requests found
......@@ -393,7 +393,11 @@ typedef struct {
#define SAFECOPY(dst,src) (strncpy(dst,src,sizeof(dst)), TERMINATE(dst))
#endif
#define SAFECAT(dst, src) if(strlen(dst) + strlen(src) < sizeof(dst)) { strcat(dst, src); }
#define SAFECAT(dst, src) do { \
if(strlen(dst) + strlen(src) < sizeof(dst)) { \
strcat(dst, src); \
} \
} while(0)
/* Bound-safe version of sprintf() - only works with fixed-length arrays */
#if (defined __FreeBSD__) || (defined __NetBSD__) || (defined __OpenBSD__) || (defined(__APPLE__) && defined(__MACH__) && defined(__POWERPC__))
......
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