diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:44:19 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:44:19 +0000 |
commit | 65ae377f3de37edbcb16041701b36a45c4ff65f6 (patch) | |
tree | 8c674c26fc4a65f5fb0b8a2719e3e95929336928 /muted.c | |
parent | 4e18ef688947854313b99f35aa30c0e7d8ae29cd (diff) |
Remaining rgagnon source audit improvements (bug #2011)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3430 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'muted.c')
-rwxr-xr-x | muted.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -25,9 +25,9 @@ static char *config = "/etc/muted.conf"; -static char host[256]; -static char user[256]; -static char pass[256]; +static char host[256] = ""; +static char user[256] = ""; +static char pass[256] = ""; static int smoothfade = 0; static int mutelevel = 20; static int muted = 0; @@ -98,17 +98,17 @@ static int load_config(void) } if (!strcasecmp(buf, "host")) { if (val && strlen(val)) - strncpy(host, val, sizeof(host)); + strncpy(host, val, sizeof(host) - 1); else fprintf(stderr, "host needs an argument (the host) at line %d\n", lineno); } else if (!strcasecmp(buf, "user")) { if (val && strlen(val)) - strncpy(user, val, sizeof(user)); + strncpy(user, val, sizeof(user) - 1); else fprintf(stderr, "user needs an argument (the user) at line %d\n", lineno); } else if (!strcasecmp(buf, "pass")) { if (val && strlen(val)) - strncpy(pass, val, sizeof(pass)); + strncpy(pass, val, sizeof(pass) - 1); else fprintf(stderr, "pass needs an argument (the password) at line %d\n", lineno); } else if (!strcasecmp(buf, "smoothfade")) { @@ -264,7 +264,7 @@ static struct channel *find_channel(char *channel) char tmp[256] = ""; char *s, *t; struct channel *chan; - strncpy(tmp, channel, sizeof(tmp)); + strncpy(tmp, channel, sizeof(tmp) - 1); s = strchr(tmp, '/'); if (s) { *s = '\0'; @@ -460,15 +460,15 @@ static int wait_event(void) return -1; } if (!strncasecmp(resp, "Event: ", strlen("Event: "))) { - strncpy(event, resp + strlen("Event: "), sizeof(event)); + strncpy(event, resp + strlen("Event: "), sizeof(event) - 1); /* Consume the rest of the non-event */ while((resp = get_line()) && strlen(resp)) { if (!strncasecmp(resp, "Channel: ", strlen("Channel: "))) - strncpy(channel, resp + strlen("Channel: "), sizeof(channel)); + strncpy(channel, resp + strlen("Channel: "), sizeof(channel) - 1); if (!strncasecmp(resp, "Newname: ", strlen("Newname: "))) - strncpy(newname, resp + strlen("Newname: "), sizeof(newname)); + strncpy(newname, resp + strlen("Newname: "), sizeof(newname) - 1); if (!strncasecmp(resp, "Oldname: ", strlen("Oldname: "))) - strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname)); + strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname) - 1); } if (strlen(channel)) { if (!strcasecmp(event, "Hangup")) |