1 diff -up bash-4.2/execute_cmd.c.coverity bash-4.2/execute_cmd.c
2 --- bash-4.2/execute_cmd.c.coverity 2011-02-24 13:04:35.000000000 +0100
3 +++ bash-4.2/execute_cmd.c 2011-02-24 13:49:13.000000000 +0100
4 @@ -5036,7 +5036,7 @@ shell_execve (command, args, env)
9 + Elf32_Half nphdr, nshdr;
11 /* We have to copy the data since the sample buffer
12 might not be aligned correctly to be accessed as
13 @@ -5044,12 +5044,12 @@ shell_execve (command, args, env)
14 memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
17 - shdr = (Elf32_Shdr *) malloc (nshdr * ehdr.e_shentsize);
18 + shdr = (Elf32_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
23 - sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
24 + sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
27 if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
28 @@ -5091,11 +5091,11 @@ shell_execve (command, args, env)
32 - phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
33 + phdr = (Elf32_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
37 - sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
38 + sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
41 if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
42 @@ -5120,7 +5120,7 @@ shell_execve (command, args, env)
47 + Elf32_Half nphdr, nshdr;
49 /* We have to copy the data since the sample buffer
50 might not be aligned correctly to be accessed as
51 @@ -5128,11 +5128,11 @@ shell_execve (command, args, env)
52 memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
55 - shdr = (Elf64_Shdr *) malloc (nshdr * ehdr.e_shentsize);
56 + shdr = (Elf64_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
60 - sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
61 + sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
64 if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
65 @@ -5174,11 +5174,11 @@ shell_execve (command, args, env)
69 - phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
70 + phdr = (Elf64_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
74 - sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
75 + sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
78 if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
79 @@ -5200,8 +5200,8 @@ shell_execve (command, args, env)
90 @@ -5250,7 +5250,8 @@ shell_execve (command, args, env)
93 #if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)