]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Some potentially unsafe fixes.
authorChris Porter <redacted>
Fri, 8 Feb 2008 18:51:41 +0000 (18:51 +0000)
committerChris Porter <redacted>
Fri, 8 Feb 2008 18:51:41 +0000 (18:51 +0000)
Should be OK I think...
Cruicky has signed off too!

13 files changed:
chanprofile/chanprofile.c
chanserv/chancmds/chanlevhistory.c
chanserv/chancmds/rollbackchan.c
chanserv/usercmds/accounthistory.c
chanserv/usercmds/rollbackaccount.c
newsearch/ns-authedpct.c
newsearch/ns-channels.c
newsearch/ns-country.c
newsearch/ns-hostpct.c
newsearch/ns-match.c
newsearch/ns-oppct.c
proxyscan/proxyscandb.c
server/server.c

index aec6f7752d1a434819d147b0f4c6a08f6c85c716..e371a200c98d5e90192eb95dfa293a0aac4f02cb 100644 (file)
@@ -24,7 +24,7 @@ struct chanprofile *getcprec(nick *np) {
   
   for (i=0;i<np->channels->cursi;i++) {
     clen+=cs[i]->index->name->length;
-    hash ^= (unsigned int )cs[i];
+    hash ^= (unsigned long)cs[i];
   }
   
   mhash=hash%CPHASHSIZE;
index 88d1e847a26439eb51662d4e37aa89361e388ca5..140474fbb57be2e64d23fe7130760a687b19f8b0 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdio.h>
 
 void csdb_dochanlevhistory_real(PGconn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned int)arg);
+  nick *np=getnickbynumeric((unsigned long)arg);
   reguser *rup, *crup1, *crup2;
   unsigned int userID, channelID, targetID;
   time_t changetime, authtime;
index 6b3bbc6a41e48b59c24514a125b2efcaadce1f31..b6b45ed8c60b2212e4df9b4d3c4f25c3bc766cc3 100644 (file)
@@ -24,7 +24,7 @@
 #include <stdio.h>
 
 void csc_dorollbackchan_real(PGconn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned int)arg);
+  nick *np=getnickbynumeric((unsigned long)arg);
   reguser *rup, *crup1, *crup2;
   chanindex *cip;
   regchan *rcp=NULL;
index 3e530dba05ec12492232efb4b73a485571e6ef6d..c6fe5319d01952faff159370a65cdde5335033d6 100644 (file)
@@ -18,7 +18,7 @@
 #include <string.h>
 
 void csdb_doaccounthistory_real(PGconn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned int)arg);
+  nick *np=getnickbynumeric((unsigned long)arg);
   reguser *rup;
   unsigned int userID;
   char *oldpass, *newpass, *oldemail, *newemail;
index d0106a1a496e6fba2b5ed34b6100181bd60b38dd..4c6a106fc7a02f30af58313e9715562a6902fbf4 100644 (file)
@@ -18,7 +18,7 @@
 #include <string.h>
 
 void csdb_dorollbackaccount_real(PGconn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned int)arg);
+  nick *np=getnickbynumeric((unsigned long)arg);
   reguser *rup;
   unsigned int userID;
   char *oldpass, *newpass, *oldemail, *newemail;
index 603b424e1146f0e91614120143de2c20a9f5bb5b..62357420cabfb702a4f77f7d0336f2113883771b 100644 (file)
@@ -52,7 +52,7 @@ void *authedpct_exe(struct searchNode *thenode, void *theinput) {
       j++;
   }
 
-  return (void *)((j * 100) / cip->channel->users->totalusers);
+  return (void *)(long)((j * 100) / cip->channel->users->totalusers);
 }  
 
 void authedpct_free(struct searchNode *thenode) {
index 5f0559887d599ee3a9905fd8ee2d393b0c3d435a..271c48461061c5a59205e4adc4e9790358cd6f32 100644 (file)
@@ -37,7 +37,7 @@ struct searchNode *channels_parse(int type, int argc, char **argv) {
 void *channels_exe(struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
 
-  return (void *)np->channels->cursi;
+  return (void *)(long)np->channels->cursi;
 }
 
 void channels_free(struct searchNode *thenode) {
index ffd87813b5e0f1468cb83dc64da0d0ff3c6c8e58..1a237e10b5dcee95b57e678e2d1daed7d80574e3 100644 (file)
@@ -20,7 +20,7 @@ int ext;
 struct searchNode *country_parse(int type, int argc, char **argv) {
   struct searchNode *thenode;
   GeoIP_LookupCode l;
-  int target;
+  long target;
 
   if (type != SEARCHTYPE_NICK) {
     parseError = "country: this function is only valid for nick searches.";
@@ -60,7 +60,7 @@ struct searchNode *country_parse(int type, int argc, char **argv) {
 
 void *country_exe(struct searchNode *thenode, void *theinput) {
   nick *np = (nick *)theinput;
-  int country = (int)thenode->localdata, rc = (int)np->exts[ext];
+  long country = (long)thenode->localdata, rc = (long)np->exts[ext];
 
   if(country == rc)
     return (void *)1;
index e37bd5a2187e3a5040b12b8e060e40d191254659..d1867ac0635766fa8923861d090b428107e38e8f 100644 (file)
@@ -57,7 +57,7 @@ void *hostpct_exe(struct searchNode *thenode, void *theinput) {
     }
   }
   
-  return (void *)((hosts * 100)/cip->channel->users->totalusers);
+  return (void *)(long)((hosts * 100)/cip->channel->users->totalusers);
 }
 
 void hostpct_free(struct searchNode *thenode) {
index 239bd0d4fce66e102bf51cd7c77d83a40048368b..d86683cb3450aa6e937fdf0472fba4519987e3ac 100644 (file)
@@ -68,7 +68,7 @@ void *match_exe(struct searchNode *thenode, void *theinput) {
   pattern = (char *)(localdata->patnode->exe) (localdata->patnode, theinput);
   target  = (char *)(localdata->targnode->exe)(localdata->targnode,theinput);
 
-  return (void *)match2strings(pattern, target);
+  return (void *)(long)match2strings(pattern, target);
 }
 
 void match_free(struct searchNode *thenode) {
index 438403a3a8816d430907ec5614032c4401eeb5be..373e0a9f8647b435dcb098c64b366471648f70be 100644 (file)
@@ -50,7 +50,7 @@ void *oppct_exe(struct searchNode *thenode, void *theinput) {
     }
   }
 
-  return (void *)((ops * 100) / cip->channel->users->totalusers);
+  return (void *)(long)((ops * 100) / cip->channel->users->totalusers);
 }
 
 void oppct_free(struct searchNode *thenode) {
index a7562139c1e7b8e8db3d37adaa4538bbfd340ad4..58d8997434ef422e542a1cc4bd37a424cfebd7f2 100644 (file)
@@ -168,7 +168,7 @@ void proxyscandbclose() {
  */
 
 void proxyscandolistopen_real(PGconn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned int)arg);
+  nick *np=getnickbynumeric((unsigned long)arg);
   PGresult *pgres;
   int i, num;
 
@@ -210,7 +210,7 @@ void proxyscandolistopen(nick *mynick, nick *usernick, time_t snce) {
  */
 
 void proxyscanspewip_real(PGconn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned int)arg);
+  nick *np=getnickbynumeric((unsigned long)arg);
   PGresult *pgres;
   int i, num;
 
@@ -253,7 +253,7 @@ void proxyscanspewip(nick *mynick, nick *usernick, unsigned long a, unsigned lon
  */
 
 void proxyscanshowkill_real(PGconn *dbconn, void *arg) {
-  nick *np=getnickbynumeric((unsigned int)arg);
+  nick *np=getnickbynumeric((unsigned long)arg);
   PGresult *pgres;
   int i, num;
 
index 852cc40f4b537b3e3d0405a5f809a899d30cf949..c2135d1ea4b044aa98142dcc67aaa346b8599228 100644 (file)
@@ -154,7 +154,7 @@ void completelink(int servernum) {
   
   /* This server is now fully linked. */
   serverlist[servernum].linkstate=LS_LINKED;
-  triggerhook(HOOK_SERVER_LINKED, (void *)servernum);
+  triggerhook(HOOK_SERVER_LINKED, (void *)(long)servernum);
   Error("server",ERR_DEBUG,"Setting link state on %s to LS_LINKED",serverlist[servernum].name->content);
 }