mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-25 14:06:27 +00:00
(closes issue #13557)
Reported by: nickpeirson
Patches:
pbx.c.patch uploaded by nickpeirson (license 579)
replace_bzero+bcopy.patch uploaded by nickpeirson (license 579)
Tested by: nickpeirson, murf
1. replaced all refs to bzero and bcopy to memset and memmove instead.
2. added a note to the CODING-GUIDELINES
3. add two macros to asterisk.h to prevent bzero, bcopy from creeping
back into the source
4. removed bzero from configure, configure.ac, autoconfig.h.in
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@147807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -262,7 +262,7 @@ static int __ao2_ref(void *user_data, const int delta)
|
||||
/* for safety, zero-out the astobj2 header and also the
|
||||
* first word of the user-data, which we make sure is always
|
||||
* allocated. */
|
||||
bzero(obj, sizeof(struct astobj2 *) + sizeof(void *) );
|
||||
memset(obj, '\0', sizeof(struct astobj2 *) + sizeof(void *) );
|
||||
free(obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -1426,7 +1426,7 @@ static int __ast_cli_unregister(struct ast_cli_entry *e, struct ast_cli_entry *e
|
||||
e->_full_cmd = NULL;
|
||||
if (e->handler) {
|
||||
/* this is a new-style entry. Reset fields and free memory. */
|
||||
bzero((char **)(e->cmda), sizeof(e->cmda));
|
||||
memset((char **)(e->cmda), '\0', sizeof(e->cmda));
|
||||
ast_free(e->command);
|
||||
e->command = NULL;
|
||||
e->usage = NULL;
|
||||
@@ -1444,7 +1444,7 @@ static int __ast_cli_register(struct ast_cli_entry *e, struct ast_cli_entry *ed)
|
||||
char **dst = (char **)e->cmda; /* need to cast as the entry is readonly */
|
||||
char *s;
|
||||
|
||||
bzero (&a, sizeof(a));
|
||||
memset(&a, '\0', sizeof(a));
|
||||
e->handler(e, CLI_INIT, &a);
|
||||
/* XXX check that usage and command are filled up */
|
||||
s = ast_skip_blanks(e->command);
|
||||
|
||||
@@ -2340,7 +2340,7 @@ int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
|
||||
struct hostent *hp;
|
||||
struct ast_hostent ahp;
|
||||
|
||||
bzero(&_sa_buf, sizeof(_sa_buf)); /* clear buffer */
|
||||
memset(&_sa_buf, '\0', sizeof(_sa_buf)); /* clear buffer */
|
||||
/* duplicate the string to strip away the :port */
|
||||
port = ast_strdupa(arg);
|
||||
buf = strsep(&port, ":");
|
||||
|
||||
@@ -1728,7 +1728,7 @@ static int ext_cmp1(const char **p)
|
||||
return 0x40000; /* XXX make this entry go last... */
|
||||
}
|
||||
|
||||
bzero(chars, sizeof(chars)); /* clear all chars in the set */
|
||||
memset(chars, '\0', sizeof(chars)); /* clear all chars in the set */
|
||||
for (; *p < end ; (*p)++) {
|
||||
unsigned char c1, c2; /* first-last char in range */
|
||||
c1 = (unsigned char)((*p)[0]);
|
||||
|
||||
@@ -675,7 +675,7 @@ int ast_stun_request(int s, struct sockaddr_in *dst,
|
||||
res = ast_select(s + 1, &rfds, NULL, NULL, &to);
|
||||
if (res <= 0) /* timeout or error */
|
||||
continue;
|
||||
bzero(&src, sizeof(src));
|
||||
memset(&src, '\0', sizeof(src));
|
||||
srclen = sizeof(src);
|
||||
/* XXX pass -1 in the size, because stun_handle_packet might
|
||||
* write past the end of the buffer.
|
||||
@@ -687,7 +687,7 @@ int ast_stun_request(int s, struct sockaddr_in *dst,
|
||||
retry, res);
|
||||
continue;
|
||||
}
|
||||
bzero(answer, sizeof(struct sockaddr_in));
|
||||
memset(answer, '\0', sizeof(struct sockaddr_in));
|
||||
stun_handle_packet(s, &src, reply_buf, res,
|
||||
stun_get_mapped, answer);
|
||||
res = 0; /* signal regular exit */
|
||||
|
||||
@@ -451,7 +451,7 @@ static void rebuild_matrix(int samples)
|
||||
|
||||
ast_debug(1, "Resetting translation matrix\n");
|
||||
|
||||
bzero(tr_matrix, sizeof(tr_matrix));
|
||||
memset(tr_matrix, '\0', sizeof(tr_matrix));
|
||||
|
||||
/* first, compute all direct costs */
|
||||
AST_RWLIST_TRAVERSE(&translators, t, list) {
|
||||
|
||||
Reference in New Issue
Block a user