Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libprop proplib: Don't run off end of buffer with...



details:   https://anonhg.NetBSD.org/src/rev/03dbca07ac13
branches:  trunk
changeset: 368784:03dbca07ac13
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Aug 03 21:20:21 2022 +0000

description:
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@localhost
https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09

diffstat:

 common/lib/libprop/prop_object.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 870fad988efd -r 03dbca07ac13 common/lib/libprop/prop_object.c
--- a/common/lib/libprop/prop_object.c  Wed Aug 03 21:13:46 2022 +0000
+++ b/common/lib/libprop/prop_object.c  Wed Aug 03 21:20:21 2022 +0000
@@ -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 @@
                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



Home | Main Index | Thread Index | Old Index