aboutsummaryrefslogtreecommitdiffstats
path: root/dns/dhid/files/patch-af
blob: cad212e50d0986be8af43dd861d30abc012bafbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--- network.c.orig  Wed Sep 12 12:13:18 2001
+++ network.c   Sat Feb 19 21:29:32 2005
@@ -290,12 +290,12 @@
    static int seed=0;
 
    if(!seed) { seed++; srandom(time(NULL)); }
-   memset(buff,0,256); 
-   memset(temp,0,128); 
+   memset(buff,0,sizeof(buff));
+   memset(temp,0,sizeof(temp));
 
    do {
-       sprintf(temp,"%u",(unsigned)random());
-       strcat(buff,temp);
+       snprintf(temp,sizeof(temp),"%u",(unsigned)random());
+       strlcat(buff,temp,sizeof(buff));
        
    } while(strlen(buff) < n);
    buff[n]='\0';
@@ -441,10 +441,10 @@
    if(j<0) return;
 
    buff[0]='\0';
-   for(i=0;i<j;i++) strcat(buff,"0");  /* Place 0's */
+   for(i=0;i<j;i++) strlcat(buff,"0",sizeof(buff));    /* Place 0's */
 
    mpz_get_str(buff2,10,x);        /* Add x */
-   strcat(buff,buff2);
+   strlcat(buff,buff2,sizeof(buff));
 
    /* Now copy n digits to str */
    cp1=str;