Author: delphij
Date: Thu Oct 23 18:23:50 2014
New Revision: 273552
URL: https://svnweb.freebsd.org/changeset/base/273552

Log:
  Test if 'env' is NULL before doing memset() and strlen(),
  the caller may pass NULL to freeenv().

Modified:
  head/sys/kern/kern_environment.c

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c    Thu Oct 23 18:03:27 2014        
(r273551)
+++ head/sys/kern/kern_environment.c    Thu Oct 23 18:23:50 2014        
(r273552)
@@ -262,7 +262,7 @@ void
 freeenv(char *env)
 {
 
-       if (dynamic_kenv) {
+       if (dynamic_kenv && env != NULL) {
                memset(env, 0, strlen(env));
                free(env, M_KENV);
        }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to