Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Mar 2016 22:54:14 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r296813 - head/bin/sh
Message-ID:  <201603132254.u2DMsETB094232@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Mar 13 22:54:14 2016
New Revision: 296813
URL: https://svnweb.freebsd.org/changeset/base/296813

Log:
  sh: Fix copying uninitialized field 'special'.
  
  This just copied uninitialized data and did not depend on it later, so it
  should not be dangerous.
  
  Found by:	clang static analyzer

Modified:
  head/bin/sh/exec.c

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Sun Mar 13 22:32:03 2016	(r296812)
+++ head/bin/sh/exec.c	Sun Mar 13 22:54:14 2016	(r296813)
@@ -332,6 +332,7 @@ find_command(const char *name, struct cm
 	if (strchr(name, '/') != NULL) {
 		entry->cmdtype = CMDNORMAL;
 		entry->u.index = 0;
+		entry->special = 0;
 		return;
 	}
 
@@ -408,6 +409,7 @@ find_command(const char *name, struct cm
 			cmdp = &loc_cmd;
 		cmdp->cmdtype = CMDNORMAL;
 		cmdp->param.index = idx;
+		cmdp->special = 0;
 		INTON;
 		goto success;
 	}
@@ -420,6 +422,7 @@ find_command(const char *name, struct cm
 	}
 	entry->cmdtype = CMDUNKNOWN;
 	entry->u.index = 0;
+	entry->special = 0;
 	return;
 
 success:
@@ -588,6 +591,7 @@ addcmdentry(const char *name, struct cmd
 	}
 	cmdp->cmdtype = entry->cmdtype;
 	cmdp->param = entry->u;
+	cmdp->special = entry->special;
 	INTON;
 }
 
@@ -604,6 +608,7 @@ defun(const char *name, union node *func
 	INTOFF;
 	entry.cmdtype = CMDFUNCTION;
 	entry.u.func = copyfunc(func);
+	entry.special = 0;
 	addcmdentry(name, &entry);
 	INTON;
 }



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