summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/conts/sp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/conts/sp.h b/include/conts/sp.h
index 2f88293..f760fd3 100644
--- a/include/conts/sp.h
+++ b/include/conts/sp.h
@@ -6,6 +6,7 @@
#include <string.h>
#include <assert.h>
#include <stdlib.h>
+#include <stdint.h>
#include <stdio.h>
#include "conts.h"
@@ -97,6 +98,8 @@ static inline void SP(trunc)(struct SP_STRUCT *s)
static inline int SP(append_strn)(struct SP_STRUCT *s, const char *buf, size_t n)
{
+ /* check for overflows, silences a gcc warning at least */
+ assert(s->l < SIZE_MAX - n);
size_t nl = s->l + n;
/* we can fit into the static buffer */