Mercurial > illumos > illumos-gate
changeset 13695:2d025fa9b1e1
344 su fails to check malloc's return value
Reviewed by: Albert Lee <trisk@nexenta.com>
Reviewed by: Enrico Papi <enricop@computer.org>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Garrett D'Amore <garrett@damore.org>
author | Milan Jurik <milan.jurik@xylab.cz> |
---|---|
date | Tue, 15 May 2012 12:48:44 -0700 |
parents | 3a75fed3cee2 |
children | 7b5944437191 |
files | usr/src/cmd/su/su.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/su/su.c Mon May 14 15:11:16 2012 -0500 +++ b/usr/src/cmd/su/su.c Tue May 15 12:48:44 2012 -0700 @@ -20,6 +20,7 @@ */ /* * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2012 Milan Jurik. All rights reserved. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ @@ -535,6 +536,10 @@ malloc(strlen(initenv[j]) + strlen(initvar) + 2); + if (var == NULL) { + perror("malloc"); + exit(4); + } (void) strcpy(var, initenv[j]); (void) strcat(var, "="); (void) strcat(var, initvar);