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.h | |
| 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.h')
| -rw-r--r-- | lib/stream.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/stream.h b/lib/stream.h index 1250b6944d..f2c16b3486 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -173,7 +173,9 @@ extern struct stream *stream_dupcat(const struct stream *s1, extern void stream_set_getp(struct stream *, size_t); extern void stream_set_endp(struct stream *, size_t); extern void stream_forward_getp(struct stream *, size_t); +extern bool stream_forward_getp2(struct stream *, size_t); extern void stream_forward_endp(struct stream *, size_t); +extern bool stream_forward_endp2(struct stream *, size_t); /* steam_put: NULL source zeroes out size_t bytes of stream */ extern void stream_put(struct stream *, const void *, size_t); @@ -453,6 +455,18 @@ static inline const uint8_t *ptr_get_be32(const uint8_t *ptr, uint32_t *out) goto stream_failure; \ } while (0) +#define STREAM_FORWARD_GETP(STR, SIZE) \ + do { \ + if (!stream_forward_getp2((STR), (SIZE))) \ + goto stream_failure; \ + } while (0) + +#define STREAM_FORWARD_ENDP(STR, SIZE) \ + do { \ + if (!stream_forward_endp2((STR), (SIZE))) \ + goto stream_failure; \ + } while (0) + #ifdef __cplusplus } #endif |
