Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Dec 2008 12:42:32 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 153883 for review
Message-ID:  <200812011242.mB1CgWIo041584@repoman.freebsd.org>

index | next in thread | raw e-mail

http://perforce.freebsd.org/chv.cgi?CH=153883

Change 153883 by rwatson@rwatson_cinnamon_macosx on 2008/12/01 12:41:51

	In userspace, malloc(3) can fail, so we need to check for and
	handle NULL returns from GET_TOKEN_AREA() in au_to_zonename().

Affected files ...

.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#77 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#77 (text+ko) ====

@@ -30,7 +30,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#76 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#77 $
  */
 
 #include <sys/types.h>
@@ -1234,9 +1234,11 @@
 	u_int16_t textlen;
 	token_t *t;
 
-	textlen = strlen(zonename);
-	textlen += 1;
+	textlen = strlen(zonename) + 1;
 	GET_TOKEN_AREA(t, dptr, sizeof(u_char) + sizeof(u_int16_t) + textlen);
+	if (t == NULL)
+		return (NULL);
+
 	ADD_U_CHAR(dptr, AUT_ZONENAME);
 	ADD_U_INT16(dptr, textlen);
 	ADD_STRING(dptr, zonename, textlen);


help

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