diff options
| author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2020-08-20 14:12:51 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-20 14:12:51 +0000 |
| commit | be8d09f1255f10b49501001d4f39c86fa26154ab (patch) | |
| tree | d84932d2ce444a57cf058625e648b1e4e6c15ced /lib/stream.c | |
| parent | e99d81a374eeeaa33c1656efff7dfc13a11f563c (diff) | |
| parent | e121d831638395785c35106274843f15b79e79a7 (diff) | |
Merge pull request #6924 from AnuradhaKaruppiah/mem-fixes
bgpd: fixes for problems found during EVPN fuzzing
Diffstat (limited to 'lib/stream.c')
| -rw-r--r-- | lib/stream.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/stream.c b/lib/stream.c index 768114e69b..6e62e11380 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -256,6 +256,18 @@ void stream_forward_getp(struct stream *s, size_t size) s->getp += size; } +bool stream_forward_getp2(struct stream *s, size_t size) +{ + STREAM_VERIFY_SANE(s); + + if (!GETP_VALID(s, s->getp + size)) + return false; + + s->getp += size; + + return true; +} + void stream_forward_endp(struct stream *s, size_t size) { STREAM_VERIFY_SANE(s); @@ -268,6 +280,18 @@ void stream_forward_endp(struct stream *s, size_t size) s->endp += size; } +bool stream_forward_endp2(struct stream *s, size_t size) +{ + STREAM_VERIFY_SANE(s); + + if (!ENDP_VALID(s, s->endp + size)) + return false; + + s->endp += size; + + return true; +} + /* Copy from stream to destination. */ bool stream_get2(void *dst, struct stream *s, size_t size) { |
