PERFORCE change 153883 for review

Robert Watson rwatson at FreeBSD.org
Mon Dec 1 04:42:33 PST 2008


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

Change 153883 by rwatson at 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);


More information about the p4-projects mailing list