This should only happen when calling with --no-act, i. e. when being called as "ifquery", as I don't think we regularly call ifup with --no-act. It's also in the "if (cmds == iface_query)" code path.
When trying to recreate this on my amd64 laptop, gdb shows that current_state gets initialized to NULL. However, the crashes on errors.ubuntu.com are all on armhf, where the local stack variable apparently just happens to be non-zero. I can force this behaviour by changing the initialization to
char *current_state = (char*) 1;
then
sudo rm /run/network/ifstate.lo
$ ./ifquery lo
crashes in this manner.
So the solution is rather simple -- initialize current_state.
This should only happen when calling with --no-act, i. e. when being called as "ifquery", as I don't think we regularly call ifup with --no-act. It's also in the "if (cmds == iface_query)" code path.
When trying to recreate this on my amd64 laptop, gdb shows that current_state gets initialized to NULL. However, the crashes on errors.ubuntu.com are all on armhf, where the local stack variable apparently just happens to be non-zero. I can force this behaviour by changing the initialization to
char *current_state = (char*) 1;
then
sudo rm /run/network/ ifstate. lo
$ ./ifquery lo
crashes in this manner.
So the solution is rather simple -- initialize current_state.