summaryrefslogtreecommitdiff
path: root/usr.sbin/btrace
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2024-02-12 15:12:10 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2024-02-12 15:12:10 +0000
commit0c7c608f759a50f607393ab2cfd23789af22d8d2 (patch)
tree4f193cfc46aa600e458a1b6272cff1424f90f99c /usr.sbin/btrace
parent817ad97029302e168dff90432c379f50ffabb219 (diff)
Fix tuple & string comparisons in maps.
Diffstat (limited to 'usr.sbin/btrace')
-rw-r--r--usr.sbin/btrace/btrace.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c
index ac291a139aa..881c2acbaa3 100644
--- a/usr.sbin/btrace/btrace.c
+++ b/usr.sbin/btrace/btrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btrace.c,v 1.84 2024/02/05 15:11:35 mpi Exp $ */
+/* $OpenBSD: btrace.c,v 1.85 2024/02/12 15:12:09 mpi Exp $ */
/*
* Copyright (c) 2019 - 2023 Martin Pieuchot <mpi@openbsd.org>
@@ -1868,6 +1868,7 @@ ba2dtflags(struct bt_arg *ba)
long
bacmp(struct bt_arg *a, struct bt_arg *b)
{
+ char astr[STRLEN];
long val;
if (a->ba_type != b->ba_type)
@@ -1877,9 +1878,12 @@ bacmp(struct bt_arg *a, struct bt_arg *b)
case B_AT_LONG:
return ba2long(a, NULL) - ba2long(b, NULL);
case B_AT_STR:
- return strcmp(ba2str(a, NULL), ba2str(b, NULL));
+ strlcpy(astr, ba2str(a, NULL), sizeof(astr));
+ return strcmp(astr, ba2str(b, NULL));
case B_AT_TUPLE:
/* Compare two lists of arguments one by one. */
+ a = a->ba_value;
+ b = b->ba_value;
do {
val = bacmp(a, b);
if (val != 0)