Skip to content

Commit

Permalink
name.c: fix possible crash in attstore()
Browse files Browse the repository at this point in the history
From OpenSUSE:
https://build.opensuse.org/package/view_file/shells/ksh/ksh93-env.dif
(the init.c fix there is already done differently in 3654ee7)

src/cmd/ksh93/sh/name.c: attstore():
- Check nv_mapchar() returns a non-null pointer before using it.
  • Loading branch information
McDutchie committed Jan 28, 2021
1 parent cc49275 commit 3ad4307
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/name.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ static void attstore(register Namval_t *np, void *data)
if((flag&(NV_UTOL|NV_LTOU|NV_INTEGER)) == (NV_UTOL|NV_LTOU))
{
data = (void*)nv_mapchar(np,0);
if(strcmp(data,e_tolower) && strcmp(data,e_toupper))
if(data && strcmp(data,e_tolower) && strcmp(data,e_toupper))
return;
}
flag &= (NV_RDONLY|NV_UTOL|NV_LTOU|NV_RJUST|NV_LJUST|NV_ZFILL|NV_INTEGER);
Expand Down

0 comments on commit 3ad4307

Please sign in to comment.