diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-07-06 15:41:18 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-06 15:41:18 -0700 |
| commit | 8dcb0f808cb95bde63de9a4c5b1ba08b5d474fea (patch) | |
| tree | 65305634a5e90c351705c52e1bc56e7b3fd3dcd3 /src/core | |
| parent | 39e61682e71872530afde44e4e304a0f49ab932a (diff) | |
| download | nng-8dcb0f808cb95bde63de9a4c5b1ba08b5d474fea.tar.gz nng-8dcb0f808cb95bde63de9a4c5b1ba08b5d474fea.tar.bz2 nng-8dcb0f808cb95bde63de9a4c5b1ba08b5d474fea.zip | |
Fix for UB (NULL pointer plus zero length). (#1459)
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/message.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/message.c b/src/core/message.c index 52065bdd..2ff2d6da 100644 --- a/src/core/message.c +++ b/src/core/message.c @@ -110,7 +110,7 @@ nni_chunk_grow(nni_chunk *ch, size_t newsz, size_t headwanted) newsz = ch->ch_len; } - if ((ch->ch_ptr >= ch->ch_buf) && + if ((ch->ch_ptr >= ch->ch_buf) && (ch->ch_ptr != NULL) && (ch->ch_ptr < (ch->ch_buf + ch->ch_cap))) { size_t headroom = (size_t)(ch->ch_ptr - ch->ch_buf); if (headwanted < headroom) { |
