]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix type mismatch in sftp_find_request
authorTim Kosse <tim.kosse@filezilla-project.org>
Fri, 18 Nov 2016 23:34:46 +0000 (00:34 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 19 Nov 2016 07:27:24 +0000 (07:27 +0000)
The id member of the sftp_request structure is of type unsigned int.
This type is also used in the sftp_reqfind callback. In
sftp_find_request we thus need to pass a pointer to unsigned int to
find234. Before this commit, sftp_find_request was passing a pointer
to unsigned long to find234, which causes the lookup to fail on
big-endian platforms where sizeof(unsigned int) != sizeof(unsigned
long), e.g. ppc64.

sftp.c

diff --git a/sftp.c b/sftp.c
index 591b60ba1f0d1cf15ed814d11cfc0ee5adec04e0..3357876c20f2eaebfe032dd4fd5eaa752cc84992 100644 (file)
--- a/sftp.c
+++ b/sftp.c
@@ -352,6 +352,7 @@ void sftp_register(struct sftp_request *req)
 struct sftp_request *sftp_find_request(struct sftp_packet *pktin)
 {
     unsigned long id;
+    unsigned fid;
     struct sftp_request *req;
 
     if (!pktin) {
@@ -363,7 +364,8 @@ struct sftp_request *sftp_find_request(struct sftp_packet *pktin)
        fxp_internal_error("did not receive a valid SFTP packet\n");
        return NULL;
     }
-    req = find234(sftp_requests, &id, sftp_reqfind);
+    fid = (unsigned)id;
+    req = find234(sftp_requests, &fid, sftp_reqfind);
 
     if (!req || !req->registered) {
        fxp_internal_error("request ID mismatch\n");