ping
On Wed, 2022-10-26 at 10:45 +0200, Martijn van Duren wrote:
> Found by Alec on misc@.
> When there's an empty table pfta_get_nextaddr jumps to fail and
> mib.c returns an agentx_varbind_notfound not libagentx, resulting
> in the upper code assuming that the object has no more entries
> after that. Note that this is not just an issue of the new code,
> but apparently no one ever noticed.
>
> I see no risk at removing the ba.pfrb_size == 0 check, since
> PFRB_FOREACH calls pfr_buf_next which does that check as well.
>
> Alec already confirmed that this diff works for him.
>
> OK?
>
> martijn@
>
Index: pf.c
===================================================================
RCS file: /cvs/src/libexec/snmpd/snmpd_metrics/pf.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 pf.c
--- pf.c 1 Sep 2022 14:20:33 -0000 1.1.1.1
+++ pf.c 26 Oct 2022 08:44:27 -0000
@@ -418,7 +418,7 @@ pfta_get_nextaddr(struct pfr_astats *ras
sizeof(filter.pfrt_name)) >= sizeof(filter.pfrt_name))
goto fail;
- if (pfta_get(&ba, &filter) || ba.pfrb_size == 0)
+ if (pfta_get(&ba, &filter))
goto fail;
PFRB_FOREACH(as, &ba) {