[elf] Fix possible null-pointer dereference.
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
This issue was found by SVACE static analyzer.
Dereference can appear at line 203 and there are no
obvious checks of `map->l_name` ptr value.
And seems that we can't be sure that this pointer
isn't NULL.
---
elf/sotruss-lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -200,7 +200,7 @@ la_objopen (struct link_map *map, Lmid_t lmid, uintptr_t *cookie)
from or that list must be empty. In the latter case we trace
only calls from the main binary. */
if (fromlist == NULL)
- result |= map->l_name[0] == '\0' ? LA_FLG_BINDFROM : 0;
+ result |= (map->l_name && map->l_name[0] == '\0') ? LA_FLG_BINDFROM : 0;
else
result |= (match_file (fromlist, full_name, full_name_len,
LA_FLG_BINDFROM)