Skip to content

Commit

Permalink
Humor asan.
Browse files Browse the repository at this point in the history
(ls would read from an uninitalized variable and never use the result because
the test is afterwards, but asan freaks about impurity and unclean quantum
state that's never observed or some such. You read uninitialized but
definitely allocated stack memory into a REGISTER, and then performed
an ADDITION on it to produce a result you never use! For SHAME!)
  • Loading branch information
landley committed Apr 14, 2020
1 parent 71ae0e1 commit 472599b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion toys/posix/ls.c
Expand Up @@ -272,7 +272,7 @@ static void listfiles(int dirfd, struct dirtree *indir)
}

memset(totals, 0, sizeof(totals));
if (CFG_TOYBOX_DEBUG) memset(len, 0, sizeof(len));
memset(len, 0, sizeof(len));

// Top level directory was already populated by main()
if (!indir->parent) {
Expand Down

0 comments on commit 472599b

Please sign in to comment.