mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-01 11:26:52 +03:00
sample: Fix a possible buffer overrun.
This commit is contained in:
@ -60,9 +60,12 @@ struct ssh_callbacks_struct cb = {
|
|||||||
|
|
||||||
static void add_cmd(char *cmd){
|
static void add_cmd(char *cmd){
|
||||||
int n;
|
int n;
|
||||||
for(n=0;cmds[n] && (n<MAXCMD);n++);
|
|
||||||
if(n==MAXCMD)
|
for (n = 0; (n < MAXCMD) && cmds[n] != NULL; n++);
|
||||||
|
|
||||||
|
if (n == MAXCMD) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
cmds[n]=strdup(cmd);
|
cmds[n]=strdup(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user