From e0c1f4798a44fdb15cd95a1654e82d7569139c58 Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 23 Oct 2023 13:07:44 +0000 Subject: [PATCH] Use xoff instead of *olen in the shift_right() call. xoff is the right value here since *olen is (conditionally) set a few lines later to the same value as xoff. Should fix the CodeQL warnings because *olen is dereferenced without proper NULL check. OK tb@ --- usr.sbin/bgpd/flowspec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bgpd/flowspec.c b/usr.sbin/bgpd/flowspec.c index 1e4a9d42821..0b2650ca174 100644 --- a/usr.sbin/bgpd/flowspec.c +++ b/usr.sbin/bgpd/flowspec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flowspec.c,v 1.4 2023/04/19 09:31:58 claudio Exp $ */ +/* $OpenBSD: flowspec.c,v 1.5 2023/10/23 13:07:44 claudio Exp $ */ /* * Copyright (c) 2023 Claudio Jeker @@ -366,7 +366,7 @@ flowspec_get_addr(const uint8_t *flow, int flowlen, int type, int is_v6, if (extract_prefix(comp + 2, complen - 2, buf, xlen, sizeof(buf)) == -1) return -1; - shift_right(addr->v6.s6_addr, buf, *olen, xlen); + shift_right(addr->v6.s6_addr, buf, xoff, xlen); *plen = comp[0]; if (olen != NULL) *olen = comp[1]; -- 2.20.1