summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-08-03 21:20:21 +0000
committerriastradh <riastradh@NetBSD.org>2022-08-03 21:20:21 +0000
commitb07b55c43e9dd3fb24477c962019ba61b84f75d0 (patch)
treee5df976939c7b6a80eae73e28a02a99f144a5312 /common
parentf7c0aabf1d92bfb1b3254ca43327e1e9a8af26d1 (diff)
proplib: Don't run off end of buffer with memcmp.
The input is required to be NUL-terminated anyway, so just use strcmp here. Reported-by: syzbot+69838802c8ec55909ba3@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09
Diffstat (limited to 'common')
-rw-r--r--common/lib/libprop/prop_object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/lib/libprop/prop_object.c b/common/lib/libprop/prop_object.c
index 3cf205052dc..8649ddc3b5c 100644
--- a/common/lib/libprop/prop_object.c
+++ b/common/lib/libprop/prop_object.c
@@ -1,4 +1,4 @@
-/* $NetBSD: prop_object.c,v 1.32 2022/08/03 21:13:46 riastradh Exp $ */
+/* $NetBSD: prop_object.c,v 1.33 2022/08/03 21:20:21 riastradh Exp $ */
/*-
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -735,7 +735,7 @@ _prop_object_internalize_context_alloc(const char *xml)
if (_PROP_EOF(*xml) || *xml != '<')
goto bad;
-#define MATCH(str) (memcmp(&xml[1], str, sizeof(str) - 1) == 0)
+#define MATCH(str) (strcmp(&xml[1], str) == 0)
/*
* Skip over the XML preamble that Apple XML property