代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/bash 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
diff --git a/execute_cmd.c b/execute_cmd.c
index a988400..412128c 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -5760,7 +5760,7 @@ shell_execve (command, args, env)
Elf32_Ehdr ehdr;
Elf32_Phdr *phdr;
Elf32_Shdr *shdr;
- int nphdr, nshdr;
+ Elf32_Half nphdr, nshdr;
/* We have to copy the data since the sample buffer
might not be aligned correctly to be accessed as
@@ -5768,12 +5768,12 @@ shell_execve (command, args, env)
memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
nshdr = ehdr.e_shnum;
- shdr = (Elf32_Shdr *) malloc (nshdr * ehdr.e_shentsize);
+ shdr = (Elf32_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
if (shdr != NULL)
{
#ifdef HAVE_PREAD
- sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
+ sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
ehdr.e_shoff);
#else
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
@@ -5815,11 +5815,11 @@ shell_execve (command, args, env)
}
nphdr = ehdr.e_phnum;
- phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
+ phdr = (Elf32_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
if (phdr != NULL)
{
#ifdef HAVE_PREAD
- sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
+ sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
ehdr.e_phoff);
#else
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
@@ -5844,7 +5844,7 @@ shell_execve (command, args, env)
Elf64_Ehdr ehdr;
Elf64_Phdr *phdr;
Elf64_Shdr *shdr;
- int nphdr, nshdr;
+ Elf32_Half nphdr, nshdr;
/* We have to copy the data since the sample buffer
might not be aligned correctly to be accessed as
@@ -5852,11 +5852,11 @@ shell_execve (command, args, env)
memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
nshdr = ehdr.e_shnum;
- shdr = (Elf64_Shdr *) malloc (nshdr * ehdr.e_shentsize);
+ shdr = (Elf64_Shdr *) malloc ((size_t)nshdr * (size_t)ehdr.e_shentsize);
if (shdr != NULL)
{
#ifdef HAVE_PREAD
- sample_len = pread (fd, shdr, nshdr * ehdr.e_shentsize,
+ sample_len = pread (fd, shdr, (size_t)nshdr * (size_t)ehdr.e_shentsize,
ehdr.e_shoff);
#else
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
@@ -5898,11 +5898,11 @@ shell_execve (command, args, env)
}
nphdr = ehdr.e_phnum;
- phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
+ phdr = (Elf64_Phdr *) malloc ((size_t)nphdr * (size_t)ehdr.e_phentsize);
if (phdr != NULL)
{
#ifdef HAVE_PREAD
- sample_len = pread (fd, phdr, nphdr * ehdr.e_phentsize,
+ sample_len = pread (fd, phdr, (size_t)nphdr * (size_t)ehdr.e_phentsize,
ehdr.e_phoff);
#else
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
@@ -5924,8 +5924,8 @@ shell_execve (command, args, env)
if (offset != -1)
{
- size_t maxlen = 0;
- size_t actlen = 0;
+ ssize_t maxlen = 0;
+ ssize_t actlen = 0;
char *interp = NULL;
do
@@ -5974,7 +5974,8 @@ shell_execve (command, args, env)
}
#endif
#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
- close (fd);
+ if (fd >= 0)
+ close (fd);
#endif
errno = i;
--
2.17.2
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。