diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-05-01 11:26:20 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2016-05-01 11:26:20 +0000 |
commit | 72dc7a03c52a08f873196af0ec1ce3805004c0c4 (patch) | |
tree | bcfb44430e415fdfb947f2df0c07de356f021bb4 /usr.bin/file | |
parent | 7948d2ebca62cd5a4ede6bf1bb7daf63b76ae37e (diff) |
Use the right size (include the length byte) when working out if a
pstring is too big.
Diffstat (limited to 'usr.bin/file')
-rw-r--r-- | usr.bin/file/magic-test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/file/magic-test.c b/usr.bin/file/magic-test.c index a47cd6dc33e..ab446a838cc 100644 --- a/usr.bin/file/magic-test.c +++ b/usr.bin/file/magic-test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magic-test.c,v 1.22 2016/05/01 10:56:03 nicm Exp $ */ +/* $OpenBSD: magic-test.c,v 1.23 2016/05/01 11:26:19 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org> @@ -733,7 +733,7 @@ magic_test_type_pstring(struct magic_line *ml, struct magic_state *ms) if (ms->size - ms->offset < 1) return (-1); slen = *(u_char *)s; - if (slen > ms->size - ms->offset) + if (slen + 1 > ms->size - ms->offset) return (-1); s++; |