Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Oct 2017 20:20:01 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r324398 - stable/11/lib/libsysdecode
Message-ID:  <201710072020.v97KK18v062614@repo.freebsd.org>

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



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