about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bounce.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/bounce.h b/bounce.h
index a2265c8..2010d45 100644
--- a/bounce.h
+++ b/bounce.h
@@ -26,6 +26,7 @@
  */
 
 #include <limits.h>
+#include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -49,6 +50,18 @@
 
 typedef unsigned char byte;
 
+static inline char *seprintf(char *ptr, char *end, const char *fmt, ...)
+	__attribute__((format(printf, 3, 4)));
+static inline char *seprintf(char *ptr, char *end, const char *fmt, ...) {
+	va_list ap;
+	va_start(ap, fmt);
+	int n = vsnprintf(ptr, end - ptr, fmt, ap);
+	va_end(ap);
+	if (n < 0) return NULL;
+	if (n > end - ptr) return end;
+	return ptr + n;
+}
+
 enum { MessageCap = 8191 + 512 };
 
 enum { ParamCap = 15 };
a href='/libretls/commit/VERSION?h=3.4.1&id=dfea3f8193aacb21edd74880d51535ae29346d2e&follow=1'>Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe