This could still read past the end of `bat`.  You could just do this:

```C
    if (!strncmp(bat, "all", 4)) {
```