You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is in the way we are using the strncmp function. Take the following example from the ftp cli:
if (!strncmp("login", param, paramLen)) {
...
}
if the user types ftp lo, this will match against ftp login as paramLen will be the length of the parameter the user typed in and not the length of the command we want to match against. This means that strncmp will compare lo against the first 2 characters of login, successfully matching.
The following change fixes this:
if (!strncmp("login", param, strlen("login"))) {
...
}
For example
mqtt log
will execute asmqtt login
, andmqtt logo
will runmqtt logout
.See this line
The string comparison only goes as far as the input string.
The text was updated successfully, but these errors were encountered: