Browse Source

Merge pull request #463 from libtom/pr/ssh-decode-encode-fix

Avoid using LOAD32H/STORE32H with unsigned long
karel-m 7 years ago
parent
commit
f413335b2a

+ 3 - 2
src/misc/ssh/ssh_decode_sequence_multi.c

@@ -33,7 +33,8 @@ int ssh_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...)
    char          *sdata;
    ulong32       *u32data;
    ulong64       *u64data;
-   unsigned long size, bufsize;
+   unsigned long bufsize;
+   ulong32       size;
 
    LTC_ARGCHK(in    != NULL);
 
@@ -53,7 +54,7 @@ int ssh_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...)
       }
 
       /* Calculate (or read) length of data */
-      size = (unsigned long)-1;
+      size = 0xFFFFFFFFU;
       switch (type) {
          case LTC_SSHDATA_BYTE:
          case LTC_SSHDATA_BOOLEAN:

+ 1 - 1
src/misc/ssh/ssh_encode_sequence_multi.c

@@ -27,7 +27,7 @@ int ssh_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...)
 {
    int           err;
    va_list       args;
-   unsigned long size;
+   ulong32       size;
    ssh_data_type type;
    void         *vdata;
    const char   *sdata;