aboutsummaryrefslogtreecommitdiff
path: root/libssh/kex.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-02 09:35:41 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-02 09:35:41 +0000
commit356a8a7631ddce16d545c9b898ef74ab165693fd (patch)
treed5ae08ca7fac4466532e21050506f7d322d790ba /libssh/kex.c
parent9f581a2809a08a4044f12c01656288a58193b2cb (diff)
downloadlibssh-356a8a7631ddce16d545c9b898ef74ab165693fd.tar.gz
libssh-356a8a7631ddce16d545c9b898ef74ab165693fd.tar.xz
libssh-356a8a7631ddce16d545c9b898ef74ab165693fd.zip
Add error checking for strdup.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@344 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/kex.c')
-rw-r--r--libssh/kex.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libssh/kex.c b/libssh/kex.c
index e325aeda..f26c4bd1 100644
--- a/libssh/kex.c
+++ b/libssh/kex.c
@@ -293,8 +293,13 @@ int set_kex(SSH_SESSION *session){
leave_function();
return -1;
} else {
- if(i>=SSH_LANG_C_S && !client->methods[i])
- client->methods[i]=strdup(""); // we can safely do that for languages
+ if ((i >= SSH_LANG_C_S) && (client->methods[i] == NULL)) {
+ /* we can safely do that for languages */
+ client->methods[i] = strdup("");
+ if (client->methods[i] == NULL) {
+ return -1;
+ }
+ }
}
}
leave_function();