mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Fix ASan buffer overflow errors caused by memcmp (#393)
This commit replaces more instances of memcmp with strncmp to fix some more heap-buffer-overflow errors in ASan, some of which can occur when running the regression tests with xtrace enabled. It combines two existing patches plus another fix in name.c for xtrace: https://www.mail-archive.com/ast-developers@lists.research.att.com/msg00877.html https://github.com/oracle/solaris-userland/blob/master/components/ksh93/patches/035-CR7036535.patch
This commit is contained in:
parent
d95700c348
commit
740a24a456
4 changed files with 5 additions and 5 deletions
|
|
@ -1526,7 +1526,7 @@ static Pathcomp_t *path_addcomp(Shell_t *shp,Pathcomp_t *first, Pathcomp_t *old,
|
|||
len = strlen(name);
|
||||
for(pp=first; pp; pp=pp->next)
|
||||
{
|
||||
if(len == pp->len && memcmp(name,pp->name,len)==0)
|
||||
if(len == pp->len && strncmp(name,pp->name,len)==0)
|
||||
{
|
||||
pp->flags |= flag;
|
||||
return(first);
|
||||
|
|
@ -1817,7 +1817,7 @@ Pathcomp_t *path_dirfind(Pathcomp_t *first,const char *name,int c)
|
|||
register Pathcomp_t *pp=first;
|
||||
while(pp)
|
||||
{
|
||||
if(memcmp(name,pp->name,pp->len)==0 && name[pp->len]==c)
|
||||
if(strncmp(name,pp->name,pp->len)==0 && name[pp->len]==c)
|
||||
return(pp);
|
||||
pp = pp->next;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue