Ver código fonte

* Port [3403] to 1.2.14
* Fix portability issue with sizeof() operator on dcc[].[sha]hash



svn: 3404

Bryan Drewery 19 anos atrás
pai
commit
ac24282d51
2 arquivos alterados com 3 adições e 3 exclusões
  1. 1 1
      src/dcc.c
  2. 2 2
      src/enclink.c

+ 1 - 1
src/dcc.c

@@ -988,7 +988,7 @@ dcc_chat_pass(int idx, char *buf, int atr)
       char randstr[51] = "";
 
       make_rand_str(randstr, 50);
-      makehash(dcc[idx].user, randstr, dcc[idx].hash, sizeof(dcc[idx].hash));
+      makehash(dcc[idx].user, randstr, dcc[idx].hash, MD5_HASH_LENGTH + 1);
 
       dcc[idx].type = &DCC_CHAT_SECPASS;
       dcc[idx].timeval = now;

+ 2 - 2
src/enclink.c

@@ -320,11 +320,11 @@ char *link_write(int snum, char *buf, size_t *len)
 
 void link_hash(int idx, char *rand)
 {
-  char hash[256] = "";
+  char hash[60] = "";
 
   /* nothing fancy, just something simple that can stop people from playing */
   simple_snprintf(hash, sizeof(hash), "enclink%s", rand);
-  strlcpy(dcc[idx].shahash, SHA1(hash), sizeof(dcc[idx].shahash));
+  strlcpy(dcc[idx].shahash, SHA1(hash), SHA_HASH_LENGTH + 1);
   egg_bzero(hash, sizeof(hash));
   return;
 }