aboutsummaryrefslogtreecommitdiffstats
path: root/dns/dhid/files/patch-ac
blob: ce7c7837e22448a51ea9c8c239190f5070d74c1b (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--- main.c.orig Fri Oct 28 23:41:02 2005
+++ main.c  Sat Jan  7 19:11:18 2006
@@ -74,7 +74,7 @@
                         unsigned char linecmd[512];
                         struct in_addr sa;
                         sa.s_addr=cp->laddr;
-                        sprintf(linecmd,"%s %d %s %s",cp->off_cmd,cp->id,
+                        snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->off_cmd,cp->id,
                         inet_ntoa((struct in_addr)sa)
                         ,cp->off_cmdp);
                         cmd_fork(linecmd);
@@ -106,7 +106,7 @@
                         unsigned char linecmd[512];
                         struct in_addr sa;
                         sa.s_addr=cp->laddr;
-                        sprintf(linecmd,"%s %d %s %s",cp->off_cmd,cp->id,
+                        snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->off_cmd,cp->id,
                         inet_ntoa((struct in_addr)sa)
                         ,cp->off_cmdp);
                         cmd_fork(linecmd);
@@ -189,7 +189,7 @@
        unsigned char linecmd[512];
        struct in_addr sa;
        sa.s_addr=cp->laddr;
-       sprintf(linecmd,"%s %d %s %s",cp->on_cmd,cp->id,
+       snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->on_cmd,cp->id,
        inet_ntoa((struct in_addr)sa)
        ,cp->on_cmdp);
        cmd_fork(linecmd);
@@ -223,8 +223,8 @@
            return;
        cp->cserver=sp;
        cp->stage=AUTH_STAGE;
-       if(cp->atype==APASS) strcpy(m.pass,cp->pass);
-       else memset(m.pass,0,16);
+       if(cp->atype==APASS) strlcpy(m.pass,cp->pass,sizeof(m.pass));
+       else memset(m.pass,0,sizeof(m.pass));
        m.hdr.opcode=AUTH_REQ;
        m.hdr.hostid=cp->id;
        m.refresh=cp->refresh;
@@ -289,14 +289,14 @@
    int c;
    extern char *optarg;
 
-   strcpy(conf_file,DHID_CONF);
-   strcpy(pid_file,DHID_PID);
+   strlcpy(conf_file,DHID_CONF,sizeof(conf_file));
+   strlcpy(pid_file,DHID_PID,sizeof(pid_file));
 
    while((c=getopt(argc,argv,"hf:p:P:"))!=EOF)
    switch(c) {
    case('p'): rport=atoi(optarg); break;
-   case('P'): strncpy(pid_file,optarg,sizeof(pid_file)); break;
-   case('f'): strncpy(conf_file,optarg,sizeof(conf_file)); break;
+   case('P'): strlcpy(pid_file,optarg,sizeof(pid_file)); break;
+   case('f'): strlcpy(conf_file,optarg,sizeof(conf_file)); break;
    case('h'): usage(argv);
    default: usage(argv);
    }
@@ -370,7 +370,7 @@
                    unsigned char linecmd[512];
                    struct in_addr sa;
                    sa.s_addr=cp->laddr;
-                   sprintf(linecmd,"%s %d %s %s",cp->off_cmd,cp->id,
+                   snprintf(linecmd,sizeof(linecmd),"%s %d %s %s",cp->off_cmd,cp->id,
                    inet_ntoa((struct in_addr)sa)
                    ,cp->off_cmdp);
                    cmd_fork(linecmd);