diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-02-20 13:45:38 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-02-20 13:45:38 +0100 |
| commit | a1c2b2fb2f18527051db2f5709d7e2cbec2b17a8 (patch) | |
| tree | c4e252fcbf4d3485edc67a43072d2c03e4248aa6 /buffer.c | |
| parent | a284af94d449046116e8c40d1adfac6091a6ffb5 (diff) | |
| download | vis-a1c2b2fb2f18527051db2f5709d7e2cbec2b17a8.tar.gz vis-a1c2b2fb2f18527051db2f5709d7e2cbec2b17a8.tar.xz | |
buffer: fix integer overflow issue
Diffstat (limited to 'buffer.c')
| -rw-r--r-- | buffer.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -65,9 +65,10 @@ bool buffer_put0(Buffer *buf, const char *data) { } bool buffer_remove(Buffer *buf, size_t pos, size_t len) { + size_t end; if (len == 0) return true; - if (pos + len > buf->len) + if (!addu(pos, len, &end) || end > buf->len) return false; memmove(buf->data + pos, buf->data + pos + len, buf->len - pos - len); buf->len -= len; |
