[ovs-dev] [PATCH 1/2] odp-util: Fix a bug that causes stack overflow

Ben Pfaff blp at ovn.org
Thu Oct 11 20:18:21 UTC 2018


On Tue, Oct 09, 2018 at 03:39:17PM -0700, Yifeng Sun wrote:
> ofpbuf_put_hex doesn't know buf's length and only checks buf's content
> to process. This is dangerous. This patch fixes it.
> 
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10865
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10863
> Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10855
> Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
> ---
>  lib/odp-util.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/odp-util.c b/lib/odp-util.c
> index 7705bb30ae21..d482d5bcf968 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -2107,6 +2107,7 @@ parse_odp_push_nsh_action(const char *s, struct ofpbuf *actions)
>              if (ovs_scan_len(s, &n, "md2=0x%511[0-9a-fA-F]", buf)) {
>                  ofpbuf_use_stub(&b, metadata,
>                                  NSH_CTX_HDRS_MAX_LEN);
> +                buf[n - 6] = '\0';

I don't understand this patch yet.  ovs_scan_len() should always
null-terminate buf.  Are there cases where it does not do that?


More information about the dev mailing list