svn commit: r323675 - head/lib/libsysdecode

Ed Maste emaste at FreeBSD.org
Sun Sep 17 14:03:56 UTC 2017


Author: emaste
Date: Sun Sep 17 14:03:54 2017
New Revision: 323675
URL: https://svnweb.freebsd.org/changeset/base/323675

Log:
  libsysdecode: report invalid cap_rights_t
  
  Previously we'd have an assertion failure in cap_rights_is_set if
  sysdecode_cap_rights is called with an invalid cap_rights_t, so test for
  validity first.
  
  PR:		222258
  Reviewed by:	cem
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D12391

Modified:
  head/lib/libsysdecode/flags.c

Modified: head/lib/libsysdecode/flags.c
==============================================================================
--- head/lib/libsysdecode/flags.c	Sun Sep 17 10:47:21 2017	(r323674)
+++ head/lib/libsysdecode/flags.c	Sun Sep 17 14:03:54 2017	(r323675)
@@ -1028,8 +1028,15 @@ void
 sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp)
 {
 	struct name_table *t;
+	int i;
 	bool comma;
 
+	for (i = 0; i < CAPARSIZE(rightsp); i++) {
+		if (CAPIDXBIT(rightsp->cr_rights[i]) != 1 << i) {
+			fprintf(fp, "invalid cap_rights_t");
+			return;
+		}
+	}
 	comma = false;
 	for (t = caprights; t->str != NULL; t++) {
 		if (cap_rights_is_set(rightsp, t->val)) {


More information about the svn-src-head mailing list