1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-02 01:17:52 +03:00

Improve sftp_handle.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@629 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-27 12:00:42 +00:00
parent 315e5aca84
commit 9d270f99a7

View File

@@ -454,15 +454,23 @@ STRING *sftp_handle_alloc(SFTP_SESSION *sftp, void *info) {
}
void *sftp_handle(SFTP_SESSION *sftp, STRING *handle){
u32 val;
if(!sftp->handles)
return NULL;
if(string_len(handle)!=sizeof(val))
return NULL;
memcpy(&val,handle->string,sizeof(u32));
if(val>SFTP_HANDLES)
return NULL;
return sftp->handles[val];
u32 val;
if (sftp->handles == NULL) {
return NULL;
}
if (string_len(handle) != sizeof(u32)) {
return NULL;
}
memcpy(&val, handle->string, sizeof(u32));
if (val > SFTP_HANDLES) {
return NULL;
}
return sftp->handles[val];
}
void sftp_handle_remove(SFTP_SESSION *sftp, void *handle){