36f8f6fb024b20cc523cdf9ebde7491eca84fd7c markd Sun Dec 6 20:33:20 2020 -0800 multiple request per connect works except hgBlat diff --git src/inc/common.h src/inc/common.h index 20fc459..fd09800 100644 --- src/inc/common.h +++ src/inc/common.h @@ -1420,30 +1420,38 @@ /* Like vasafef, but truncates the formatted string instead of barfing on * overflow. */ void truncatef(char *buf, int size, char *format, ...); /* Like safef, but truncates the formatted string instead of barfing on * overflow. */ int safef(char* buffer, int bufSize, char *format, ...) /* Format string to buffer, vsprintf style, only with buffer overflow * checking. The resulting string is always terminated with zero byte. */ #ifdef __GNUC__ __attribute__((format(printf, 3, 4))) #endif ; +int safefcat(char* buffer, int bufSize, char *format, ...) +/* Safely format string to the end of the buffer. Returns number of characters + * appended. */ +#ifdef __GNUC__ +__attribute__((format(printf, 3, 4))) +#endif +; + void safecpy(char *buf, size_t bufSize, const char *src); /* copy a string to a buffer, with bounds checking.*/ void safencpy(char *buf, size_t bufSize, const char *src, size_t n); /* copy n characters from a string to a buffer, with bounds checking. * Unlike strncpy, always null terminates the result */ void safecat(char *buf, size_t bufSize, const char *src); /* Append a string to a buffer, with bounds checking.*/ void safencat(char *buf, size_t bufSize, const char *src, size_t n); /* append n characters from a string to a buffer, with bounds checking. */ void safememset(char *buf, size_t bufSize, const char c, size_t n); /* Append a character to a buffer repeatedly, n times with bounds checking.*/