diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-09-16 16:50:17 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2026-09-16 16:50:17 +0300 |
| commit | 32135c9f1e9defd884b7cc1157722678ba4994d2 (patch) | |
| tree | ff4a5467bc5d47f7fc9493bae8bae7fafc9f6d6a /include | |
| parent | 4b399ecfe921bc276086f55d4038caa887925c59 (diff) | |
| download | conts-32135c9f1e9defd884b7cc1157722678ba4994d2.tar.gz conts-32135c9f1e9defd884b7cc1157722678ba4994d2.zip | |
Diffstat (limited to 'include')
| -rw-r--r-- | include/conts/sp.h | 3 |
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 */ |
