diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2021-10-24 17:43:39 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2021-10-24 17:43:39 +0000 |
commit | 9d5d4421c6a7791a58ac3480fbac697d5ff2fc12 (patch) | |
tree | c91e0f9a48fa1c8253b3d090f37a5f8f824a0200 | |
parent | 8acfbf99b8c2be880b87cf271e3e5155a8e7ae43 (diff) |
Initialize OID print buffer, even when oidlen is 0.
Fix printing old garbage from previous conversions.
OK tb@
-rw-r--r-- | lib/libagentx/ax.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libagentx/ax.c b/lib/libagentx/ax.c index f2e159fa4f6..4f963224855 100644 --- a/lib/libagentx/ax.c +++ b/lib/libagentx/ax.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ax.c,v 1.7 2021/01/02 01:06:31 rob Exp $ */ +/* $OpenBSD: ax.c,v 1.8 2021/10/24 17:43:38 martijn Exp $ */ /* * Copyright (c) 2019 Martijn van Duren <martijn@openbsd.org> * @@ -764,6 +764,8 @@ ax_oidrange2string(struct ax_oid *oid, uint8_t range_subid, rest = sizeof(buf); p = buf; + if (oid->aoi_idlen == 0) + (void)strlcpy(buf, "null", sizeof(buf)); for (i = 0; i < oid->aoi_idlen; i++) { if (range_subid != 0 && range_subid - 1 == (uint8_t)i) ret = snprintf(p, rest, ".[%u-%u]", oid->aoi_id[i], |