mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 18:04:25 +09:00
Add missing argument checks for options.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@350 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -95,6 +95,10 @@ SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt) {
|
|||||||
SSH_OPTIONS *new = NULL;
|
SSH_OPTIONS *new = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (opt == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
new = ssh_options_new();
|
new = ssh_options_new();
|
||||||
if (new == NULL) {
|
if (new == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -224,6 +228,10 @@ int ssh_options_set_host(SSH_OPTIONS *opt, const char *hostname){
|
|||||||
char *h;
|
char *h;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
if (opt == NULL || hostname == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
h = strdup(hostname);
|
h = strdup(hostname);
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -269,6 +277,10 @@ int ssh_options_set_host(SSH_OPTIONS *opt, const char *hostname){
|
|||||||
* @bug this should not be set at options time
|
* @bug this should not be set at options time
|
||||||
*/
|
*/
|
||||||
int ssh_options_set_username(SSH_OPTIONS *opt, const char *username) {
|
int ssh_options_set_username(SSH_OPTIONS *opt, const char *username) {
|
||||||
|
if (opt == NULL || username == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (opt->username) {
|
if (opt->username) {
|
||||||
SAFE_FREE(opt->username);
|
SAFE_FREE(opt->username);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user