<div dir="ltr">Hi,<div><br></div><div>I was trying toybox in nexus 9 android M preview and saw that killall tries to kill "all" pid and pidof whatever_you_type_without_a_slash_at_the_beginning answers with a list containing all existing pids. </div><div>I am not sure if it belongs here or to the android bugtracker. </div><div><br></div><div>My findings:</div><div><br></div><div>in lib.c line 819 </div><div>         : !strcmp(basename(cmd), basename(*curname)))<br></div><div><br></div><div>call to basename in both strcmp arguments does not work as expected since the bionic basename  gives back always the same address for the returned char*</div><div><br></div><div>I was not able to find a reliable source for the expected behavior of baseline concerning the return buffer address and allocation.</div><div><br></div><div>1) should we try to fix it here or is it up to android to fix bionic basename behavior?</div><div><br></div><div>2) if fix should be in toybox, </div><div>a quick&dirty fix would be to copy the first basename(cmd) result into cmd, since it's supposed to be smaller in length and cmd is not reused with the same value anymore, but it relies on the assumption that buffers are not overlapping, or that strcpy is able to shift to left without mangling buffer content. If it needs to be safer, one can always allocate a temp buffer...</div><div><br></div><div>Nicolas</div></div>