summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2026-09-16 16:50:17 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2026-09-16 16:50:17 +0300
commit32135c9f1e9defd884b7cc1157722678ba4994d2 (patch)
treeff4a5467bc5d47f7fc9493bae8bae7fafc9f6d6a
parent4b399ecfe921bc276086f55d4038caa887925c59 (diff)
downloadconts-master.tar.gz
conts-master.zip
silence overflow warningHEADmaster
-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 */