Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/common/ctf properly check for type ...



details:   https://anonhg.NetBSD.org/src/rev/1544e91b8c3a
branches:  trunk
changeset: 344644:1544e91b8c3a
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 09 17:51:50 2016 +0000

description:
properly check for type id overflow

diffstat:

 external/cddl/osnet/dist/common/ctf/ctf_create.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r 5ba6214ed322 -r 1544e91b8c3a external/cddl/osnet/dist/common/ctf/ctf_create.c
--- a/external/cddl/osnet/dist/common/ctf/ctf_create.c  Sat Apr 09 17:50:54 2016 +0000
+++ b/external/cddl/osnet/dist/common/ctf/ctf_create.c  Sat Apr 09 17:51:50 2016 +0000
@@ -616,7 +616,8 @@
        if (!(fp->ctf_flags & LCTF_RDWR))
                return (ctf_set_errno(fp, ECTF_RDONLY));
 
-       if (CTF_INDEX_TO_TYPE(fp->ctf_dtnextid, 1) > CTF_MAX_TYPE)
+       if (!CTF_TYPE_ISCHILD(fp->ctf_dtnextid) ||
+           CTF_INDEX_TO_TYPE(fp->ctf_dtnextid, 1) > CTF_MAX_TYPE)
                return (ctf_set_errno(fp, ECTF_FULL));
 
        if ((dtd = ctf_alloc(sizeof (ctf_dtdef_t))) == NULL)



Home | Main Index | Thread Index | Old Index