mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Remaining rgagnon source audit improvements (bug #2011)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
15
enum.c
15
enum.c
@@ -94,7 +94,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
|
||||
regmatch_t pmatch[9];
|
||||
|
||||
|
||||
strcpy(dst, "");
|
||||
dst[0] = '\0';
|
||||
|
||||
if (len < sizeof(struct naptr)) {
|
||||
ast_log(LOG_WARNING, "Length too short\n");
|
||||
@@ -151,7 +151,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
|
||||
}
|
||||
|
||||
/* DEDBUGGING STUB
|
||||
strcpy(regexp, "!^\\+43(.*)$!\\1@bla.fasel!");
|
||||
strncpy(regexp, "!^\\+43(.*)$!\\1@bla.fasel!", sizeof(regexp) - 1);
|
||||
*/
|
||||
|
||||
regexp_len = strlen(regexp);
|
||||
@@ -222,7 +222,8 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize
|
||||
}
|
||||
}
|
||||
*d = 0;
|
||||
strncpy(dst, temp, dstsize);
|
||||
strncpy(dst, temp, dstsize - 1);
|
||||
dst[dstsize - 1] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -245,8 +246,8 @@ static int txt_callback(void *context, u_char *answer, int len, u_char *fullansw
|
||||
|
||||
if (answer != NULL) {
|
||||
c->txtlen = strlen(answer);
|
||||
strncpy(c->txt, answer, 255);
|
||||
c->txt[c->txtlen] = 0;
|
||||
strncpy(c->txt, answer, sizeof(c->txt) - 1);
|
||||
c->txt[sizeof(c->txt) - 1] = 0;
|
||||
return 1;
|
||||
} else {
|
||||
c->txt = NULL;
|
||||
@@ -309,7 +310,7 @@ int ast_get_enum(struct ast_channel *chan, const char *number, char *dst, int ds
|
||||
s = s->next;
|
||||
}
|
||||
if (s) {
|
||||
strcpy(tmp + newpos, s->toplev);
|
||||
strncpy(tmp + newpos, s->toplev, sizeof(tmp) - newpos - 1);
|
||||
}
|
||||
ast_mutex_unlock(&enumlock);
|
||||
if (!s)
|
||||
@@ -368,7 +369,7 @@ int ast_get_txt(struct ast_channel *chan, const char *number, char *dst, int dst
|
||||
s = s->next;
|
||||
}
|
||||
if (s) {
|
||||
strcpy(tmp + newpos, s->toplev);
|
||||
strncpy(tmp + newpos, s->toplev, sizeof(tmp) - newpos - 1);
|
||||
}
|
||||
ast_mutex_unlock(&enumlock);
|
||||
if (!s)
|
||||
|
Reference in New Issue
Block a user