[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH]miscellaneous small fixes - bash-3.1
From: |
Loulwa Salem |
Subject: |
[PATCH]miscellaneous small fixes - bash-3.1 |
Date: |
Thu, 29 Jun 2006 17:26:51 -0500 |
User-agent: |
Mozilla Thunderbird 1.0.7 (Windows/20050923) |
Hi,
The following issues were found by Coverity source code scanner.
The patch below resolves some minor issues found in the bash-3.1 package; such
as uninitialized variable use, dead code, and dereferencing a null.
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACH\TYPE='i386-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bas\h' -DSHELL
-DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=\64 -O2 -g -pipe -m32 -march=i386 -mtune=pentium4
uname output: Linux system.ibm.com 2.6.9-11.ELsmp #1 SMP Fri May 20 18:26:27 EDT
2005 i68\6 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu
Bash Version: 3.0
Patch Level: 15
Release Status: release
Description:
1 - at line 1200 - if (asynchronous): asynchronous is always = 0 after that line
(asynchronous is assigned value 0 within the if() statement). Therefore
code at lines 1228 and 1229 will not be reached. Removing it.
2 - "nalloca" variable is being compared to "ALLOCA_MAX" on line 501 without it
being initialized before that. Initialized it to 0.
3 - if (destp == NULL) then we are dereferencing a null pointer within the if()
by doing *destp = NULL. To fix it I added a null check for destp within
if().
- Loulwa
diff -uprN bash-3.1/execute_cmd.c bash-3.1-uninit/execute_cmd.c
--- bash-3.1/execute_cmd.c 2005-11-05 13:37:21.000000000 -0600
+++ bash-3.1-uninit/execute_cmd.c 2006-06-28 11:21:06.342945920 -0500
@@ -1225,8 +1225,6 @@ execute_in_subshell (command, asynchrono
reset_terminating_signals (); /* in sig.c */
/* Cancel traps, in trap.c. */
restore_original_signals ();
- if (asynchronous)
- setup_async_signals ();
#if defined (JOB_CONTROL)
set_sigchld_handler ();
diff -uprN bash-3.1/lib/glob/glob.c bash-3.1-uninit/lib/glob/glob.c
--- bash-3.1/lib/glob/glob.c 2005-03-24 11:42:27.000000000 -0600
+++ bash-3.1-uninit/lib/glob/glob.c 2006-06-28 09:49:16.583556664 -0500
@@ -356,6 +356,7 @@ glob_vector (pat, dir, flags)
int nalloca;
struct globval *firstmalloc, *tmplink;
+ nalloca = 0;
lastlink = 0;
count = lose = skip = 0;
diff -uprN bash-3.1/lib/glob/xmbsrtowcs.c bash-3.1-uninit/lib/glob/xmbsrtowcs.c
--- bash-3.1/lib/glob/xmbsrtowcs.c 2004-12-02 09:13:18.000000000 -0600
+++ bash-3.1-uninit/lib/glob/xmbsrtowcs.c 2006-06-29 11:23:24.971074752
-0500
@@ -145,7 +145,8 @@ xdupmbstowcs (destp, indicesp, src)
/* In case SRC or DESP is NULL, conversion doesn't take place. */
if (src == NULL || destp == NULL)
{
- *destp = NULL;
+ if (destp)
+ *destp = NULL;
return (size_t)-1;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH]miscellaneous small fixes - bash-3.1,
Loulwa Salem <=