]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix bug in Crypto_RetrieveLocalKey
authorJan Behrens <zykure@web.de>
Sun, 18 Aug 2013 11:07:30 +0000 (13:07 +0200)
committerJan Behrens <zykure@web.de>
Sun, 18 Aug 2013 11:07:30 +0000 (13:07 +0200)
crypto.c

index 2baa5a97fd0d921a3962f346b47761bc8f6e9deb..25900136b4df69dc725b6ff14394c6c748b6d0b4 100644 (file)
--- a/crypto.c
+++ b/crypto.c
@@ -506,7 +506,7 @@ crypto_data_t;
 
 static crypto_t *Crypto_ServerFindInstance(lhnetaddress_t *peeraddress, qboolean allow_create)
 {
-       crypto_t *crypto; 
+       crypto_t *crypto;
        int i, best;
 
        if(!d0_blind_id_dll)
@@ -621,7 +621,7 @@ static void Crypto_StoreHostKey(lhnetaddress_t *peeraddress, const char *keystri
 
        if(!d0_blind_id_dll)
                return;
-       
+
        // syntax of keystring:
        // aeslevel id@key id@key ...
 
@@ -726,16 +726,16 @@ int Crypto_RetrieveLocalKey(int keyid, char *keyfp, size_t keyfplen, char *idfp,
        if(keyid < 0 || keyid >= MAX_PUBKEYS)
                return 0;
        if(keyfp)
-               *keyfp = 0;
+                *keyfp = 0;
        if(idfp)
-               *idfp = 0;
+                *idfp = 0;
        if(!pubkeys[keyid])
                return -1;
-       if(keyfp)
-               strlcpy(keyfp, pubkeys_fp64[keyid], keyfplen);
-       if(idfp)
-               if(pubkeys_havepriv[keyid])
-                       strlcpy(idfp, pubkeys_priv_fp64[keyid], keyfplen);
+       if(keyfplen)
+                strlcpy(keyfp, pubkeys_fp64[keyid], keyfplen);
+       if(idfplen)
+                if(pubkeys_havepriv[keyid])
+                        strlcpy(idfp, pubkeys_priv_fp64[keyid], idfplen);
        if(issigned)
                *issigned = pubkeys_havesig[keyid];
        return 1;