Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Sep 2017 14:03:55 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323675 - head/lib/libsysdecode
Message-ID:  <201709171403.v8HE3tFf080423@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709171403.v8HE3tFf080423>