svn commit: r324398 - stable/11/lib/libsysdecode

Ed Maste emaste at FreeBSD.org
Sat Oct 7 20:20:03 UTC 2017


Author: emaste
Date: Sat Oct  7 20:20:01 2017
New Revision: 324398
URL: https://svnweb.freebsd.org/changeset/base/324398

Log:
  MFC r323675: 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
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/11/lib/libsysdecode/flags.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libsysdecode/flags.c
==============================================================================
--- stable/11/lib/libsysdecode/flags.c	Sat Oct  7 20:18:20 2017	(r324397)
+++ stable/11/lib/libsysdecode/flags.c	Sat Oct  7 20:20:01 2017	(r324398)
@@ -988,8 +988,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-all mailing list