diff options
-rwxr-xr-x | acl.c | 4 | ||||
-rwxr-xr-x | apps/app_voicemail.c | 8 | ||||
-rwxr-xr-x | asterisk.c | 10 | ||||
-rwxr-xr-x | channels/chan_mgcp.c | 4 | ||||
-rwxr-xr-x | logger.c | 4 | ||||
-rwxr-xr-x | pbx/pbx_dundi.c | 4 |
6 files changed, 17 insertions, 17 deletions
@@ -405,7 +405,7 @@ struct ast_netsock *ast_netsock_bind(struct ast_netsock_list *list, struct io_co int ast_find_ourip(struct in_addr *ourip, struct sockaddr_in bindaddr) { - char ourhost[256]; + char ourhost[MAXHOSTNAMELEN]=""; struct ast_hostent ahp; struct hostent *hp; struct in_addr saddr; @@ -416,7 +416,7 @@ int ast_find_ourip(struct in_addr *ourip, struct sockaddr_in bindaddr) return 0; } /* try to use our hostname */ - if (gethostname(ourhost, sizeof(ourhost))) { + if (gethostname(ourhost, sizeof(ourhost)-1)) { ast_log(LOG_WARNING, "Unable to get hostname\n"); } else { hp = ast_gethostbyname(ourhost, &ahp); diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index b3fb4f9cc..c087e7de3 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1463,7 +1463,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c FILE *p=NULL; int pfd; char date[256]; - char host[256]; + char host[MAXHOSTNAMELEN] = ""; char who[256]; char bound[256]; char fname[256]; @@ -1491,7 +1491,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c } } if (p) { - gethostname(host, sizeof(host)); + gethostname(host, sizeof(host)-1); if (strchr(srcemail, '@')) strncpy(who, srcemail, sizeof(who)-1); else { @@ -1618,7 +1618,7 @@ static int sendpage(char *srcemail, char *pager, int msgnum, char *context, char FILE *p=NULL; int pfd; char date[256]; - char host[256]; + char host[MAXHOSTNAMELEN]=""; char who[256]; char dur[256]; char tmp[80] = "/tmp/astmail-XXXXXX"; @@ -1637,7 +1637,7 @@ static int sendpage(char *srcemail, char *pager, int msgnum, char *context, char } if (p) { - gethostname(host, sizeof(host)); + gethostname(host, sizeof(host)-1); if (strchr(srcemail, '@')) strncpy(who, srcemail, sizeof(who)-1); else { diff --git a/asterisk.c b/asterisk.c index acf5849aa..379f335ef 100755 --- a/asterisk.c +++ b/asterisk.c @@ -273,12 +273,12 @@ static pthread_t lthread; static void *netconsole(void *vconsole) { struct console *con = vconsole; - char hostname[256]; + char hostname[MAXHOSTNAMELEN]=""; char tmp[512]; int res; struct pollfd fds[2]; - if (gethostname(hostname, sizeof(hostname))) + if (gethostname(hostname, sizeof(hostname)-1)) strncpy(hostname, "<Unknown>", sizeof(hostname)-1); snprintf(tmp, sizeof(tmp), "%s/%d/%s\n", hostname, ast_mainpid, ASTERISK_VERSION); fdprint(con->fd, tmp); @@ -1026,7 +1026,7 @@ static char *cli_prompt(EditLine *el) memset(prompt, 0, sizeof(prompt)); while (*t != '\0' && *p < sizeof(prompt)) { if (*t == '%') { - char hostname[256]; + char hostname[MAXHOSTNAMELEN]=""; int i; struct timeval tv; struct tm tm; @@ -1668,7 +1668,7 @@ int main(int argc, char *argv[]) { int c; char filename[80] = ""; - char hostname[256]; + char hostname[MAXHOSTNAMELEN]=""; char tmp[80]; char * xarg = NULL; int x; @@ -1693,7 +1693,7 @@ int main(int argc, char *argv[]) option_remote++; option_nofork++; } - if (gethostname(hostname, sizeof(hostname))) + if (gethostname(hostname, sizeof(hostname)-1)) strncpy(hostname, "<Unknown>", sizeof(hostname)-1); ast_mainpid = getpid(); ast_ulaw_init(); diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index e1e8afcf2..5d4621f55 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -248,7 +248,7 @@ static int restart_monitor(void); static int capability = AST_FORMAT_ULAW; static int nonCodecCapability = AST_RTP_DTMF; -static char ourhost[256]; +static char ourhost[MAXHOSTNAMELEN]; static struct in_addr __ourip; static int ourport; @@ -4096,7 +4096,7 @@ static int reload_config(void) struct hostent *hp; int format; - if (gethostname(ourhost, sizeof(ourhost))) { + if (gethostname(ourhost, sizeof(ourhost)-1)) { ast_log(LOG_WARNING, "Unable to get hostname, MGCP disabled\n"); return 0; } @@ -75,7 +75,7 @@ static struct msglist { struct msglist *next; } *list = NULL, *last = NULL; -static char hostname[256]; +static char hostname[MAXHOSTNAMELEN]; enum logtypes { LOGTYPE_SYSLOG, @@ -294,7 +294,7 @@ static void init_logger_chain(void) ast_mutex_lock(&loglock); if ((s = ast_variable_retrieve(cfg, "general", "appendhostname"))) { if(ast_true(s)) { - if(gethostname(hostname, sizeof(hostname))) { + if(gethostname(hostname, sizeof(hostname)-1)) { strncpy(hostname, "unknown", sizeof(hostname)-1); ast_log(LOG_WARNING, "What box has no hostname???\n"); } diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index ca3c4441a..323449da0 100755 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -4453,7 +4453,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin) char *cat; int format; int x; - char hn[256]; + char hn[MAXHOSTNAMELEN]=""; struct ast_hostent he; struct hostent *hp; struct sockaddr_in sin2; @@ -4470,7 +4470,7 @@ static int set_config(char *config_file, struct sockaddr_in* sin) return -1; } ipaddr[0] = '\0'; - if (!gethostname(hn, sizeof(hn))) { + if (!gethostname(hn, sizeof(hn)-1)) { hp = ast_gethostbyname(hn, &he); if (hp) { memcpy(&sin2.sin_addr, hp->h_addr, sizeof(sin2.sin_addr)); |