[PATCH 08/10] trace: Use strncmp to match function names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Benjamin Berg <benjamin.berg@xxxxxxxxx>

The functions specified by the user might be longer than the function in
the backtrace, potentially overflowing the memcmp. In practice, it
should not be a relevant out-of-memory read. However, we can use strncmp
instead.

Note that, as before, this is only a prefix match. If a function name is
longer in the backtrace it will still match.

Signed-off-by: Benjamin Berg <benjamin.berg@xxxxxxxxx>
---
 src/utils/os_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/utils/os_unix.c b/src/utils/os_unix.c
index d5870669a7..b665c79a25 100644
--- a/src/utils/os_unix.c
+++ b/src/utils/os_unix.c
@@ -611,7 +611,7 @@ int testing_test_fail(const char *tag, bool is_alloc)
 			len = next - pos;
 		else
 			len = os_strlen(pos);
-		if (os_memcmp(pos, func[i], len) != 0) {
+		if (os_strncmp(pos, func[i], len) != 0) {
 			if (maybe && next) {
 				pos = next + 1;
 				continue;
-- 
2.45.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux