svn commit: r356718 - stable/12/lib/libjail

Mark Johnston markj at FreeBSD.org
Tue Jan 14 02:41:53 UTC 2020


Author: markj
Date: Tue Jan 14 02:41:52 2020
New Revision: 356718
URL: https://svnweb.freebsd.org/changeset/base/356718

Log:
  MFC r356476:
  libjail: Handle an error from reallocarray() when trimming the buffer.
  
  PR:	243106

Modified:
  stable/12/lib/libjail/jail.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libjail/jail.c
==============================================================================
--- stable/12/lib/libjail/jail.c	Tue Jan 14 02:14:15 2020	(r356717)
+++ stable/12/lib/libjail/jail.c	Tue Jan 14 02:41:52 2020	(r356718)
@@ -263,7 +263,10 @@ jailparam_all(struct jailparam **jpp)
 			goto error;
 		mib1[1] = 2;
 	}
-	jp = reallocarray(jp, njp, sizeof(*jp));
+	/* Just return the untrimmed buffer if reallocarray() somehow fails. */
+	tjp = reallocarray(jp, njp, sizeof(*jp));
+	if (tjp != NULL)
+		jp = tjp;
 	*jpp = jp;
 	return (njp);
 


More information about the svn-src-all mailing list