aboutsummaryrefslogtreecommitdiffstats
path: root/dns/dhid/files/patch-ac
blob: c6e63b0a7cfae81e272717af12ff07dadc62daf2 (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 2008-04-22 22:37:12.000000000 +0000
+++ main.c  2008-04-29 04:16:08.000000000 +0000
@@ -74,7 +74,7 @@
                         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 @@
                         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);
@@ -191,7 +191,7 @@
        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;
@@ -292,14 +292,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);
    }
@@ -381,7 +381,7 @@
                    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);
                    }