summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-02 11:47:06 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-02 11:47:06 +0000
commit71913c8fea05f4e90277642265667c312f4831ee (patch)
tree93d012459d60df36b6f16d31a4258a48d52ba785
parent8de3dc44ca3dc4285d34925be5a7b4fee8e95408 (diff)
downloadlibssh-71913c8fea05f4e90277642265667c312f4831ee.tar.gz
libssh-71913c8fea05f4e90277642265667c312f4831ee.tar.xz
libssh-71913c8fea05f4e90277642265667c312f4831ee.zip
Add missing argument checks for options.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@350 7dcaeef0-15fb-0310-b436-a5af3365683c
-rw-r--r--libssh/options.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libssh/options.c b/libssh/options.c
index 2bdc589..77bf1f4 100644
--- a/libssh/options.c
+++ b/libssh/options.c
@@ -95,6 +95,10 @@ SSH_OPTIONS *ssh_options_copy(SSH_OPTIONS *opt) {
SSH_OPTIONS *new = NULL;
int i;
+ if (opt == NULL) {
+ return NULL;
+ }
+
new = ssh_options_new();
if (new == NULL) {
return NULL;
@@ -224,6 +228,10 @@ int ssh_options_set_host(SSH_OPTIONS *opt, const char *hostname){
char *h;
char *p;
+ if (opt == NULL || hostname == NULL) {
+ return -1;
+ }
+
h = strdup(hostname);
if (h == NULL) {
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
*/
int ssh_options_set_username(SSH_OPTIONS *opt, const char *username) {
+ if (opt == NULL || username == NULL) {
+ return -1;
+ }
+
if (opt->username) {
SAFE_FREE(opt->username);
}