joelagnel / bpfd

BPFd (Deprecated, please see README.md) : Berkeley Packet Filter daemon (BPFd). Makes it possible to run BCC tools across systems.
Apache License 2.0
95 stars 23 forks source link

Prevent crash when processing only a space character #2

Closed ghost closed 6 years ago

ghost commented 6 years ago

The call to strtok may return a NULL pointer if the input string contains only the separator (in this case, a space). A check is needed before passing this pointer to strlen to prevent a segmentation fault (caused by the read at 0x0).