aboutsummaryrefslogtreecommitdiff
path: root/libssh
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-07-23 08:09:57 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-07-23 08:09:57 +0200
commit5aa9cf2fcf3fc062f4560df52e3d48d894e0ba6e (patch)
treee915591576d8c3ac2d450ed078344d5b4a5f2a24 /libssh
parenta9248690961b96aafb9065916f4263ff6ba48c0c (diff)
downloadlibssh-5aa9cf2fcf3fc062f4560df52e3d48d894e0ba6e.tar.gz
libssh-5aa9cf2fcf3fc062f4560df52e3d48d894e0ba6e.tar.xz
libssh-5aa9cf2fcf3fc062f4560df52e3d48d894e0ba6e.zip
Add consistency check to ssh_set_callbacks
Diffstat (limited to 'libssh')
-rw-r--r--libssh/callbacks.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libssh/callbacks.c b/libssh/callbacks.c
index 7553ca6..1568d51 100644
--- a/libssh/callbacks.c
+++ b/libssh/callbacks.c
@@ -28,10 +28,16 @@
int ssh_set_callbacks(ssh_session session, ssh_callbacks cb) {
if (session == NULL || cb == NULL) {
- return -1;
+ return SSH_ERROR;
+ }
+ enter_function();
+ if(cb->size <= 0 || cb->size > 1024 * sizeof(void *)){
+ ssh_set_error(session,SSH_FATAL,
+ "Invalid callback passed in (badly initialized)");
+ leave_function();
+ return SSH_ERROR;
}
-
session->callbacks = cb;
-
+ leave_function();
return 0;
}