Skip to content

Commit 0eac47d

Browse files
jkbonfielddaviesrob
authored andcommitted
Avoid warning from gcc8 about memcpy overflow
1 parent 0ce6702 commit 0eac47d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

htslib/kstring.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ static inline char *ks_release(kstring_t *s)
156156

157157
static inline int kputsn(const char *p, size_t l, kstring_t *s)
158158
{
159+
if (l > SIZE_MAX-2)
160+
return EOF;
161+
159162
size_t new_sz = s->l + l + 2;
160163
if (new_sz < s->l || ks_resize(s, new_sz) < 0)
161164
return EOF;

0 commit comments

Comments
 (0)