Fixed usage of uninitialized memory, thax to valgrind
This commit is contained in:
parent
155d3b5a1d
commit
cdca6a7135
|
@ -45,20 +45,22 @@ const char *numberrize_callerinfo(const char *string, int ntype, const char *nat
|
|||
|
||||
case INFO_NTYPE_INTERNATIONAL:
|
||||
strcpy(result, international);
|
||||
strncat(result, string, sizeof(result)-strlen(result)-1);
|
||||
strncat(result, string, sizeof(result)-1);
|
||||
result[sizeof(result)-1] = '\0';
|
||||
return(result);
|
||||
break;
|
||||
|
||||
case INFO_NTYPE_NATIONAL:
|
||||
strcpy(result, national);
|
||||
strncat(result, string, sizeof(result)-strlen(result)-1);
|
||||
strncat(result, string, sizeof(result)-1);
|
||||
result[sizeof(result)-1] = '\0';
|
||||
return(result);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(string);
|
||||
strncpy(result, string, sizeof(result)-1);
|
||||
result[sizeof(result)-1] = '\0';
|
||||
return(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -405,6 +405,8 @@ static int _bchannel_create(struct mISDNport *mISDNport, int i)
|
|||
int ret;
|
||||
struct sockaddr_mISDN addr;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
|
||||
if (mISDNport->b_sock[i].inuse) {
|
||||
PERROR("Error: Socket already created for index %d\n", i);
|
||||
return(0);
|
||||
|
@ -1817,6 +1819,8 @@ int mISDN_getportbyname(int sock, int cnt, char *portname)
|
|||
struct mISDN_devinfo devinfo;
|
||||
int port = 0, ret;
|
||||
|
||||
memset(&devinfo, 0, sizeof(devinfo));
|
||||
|
||||
/* resolve name */
|
||||
while (port < cnt) {
|
||||
devinfo.id = port;
|
||||
|
@ -1892,6 +1896,8 @@ struct mISDNport *mISDNport_open(struct interface_port *ifport)
|
|||
struct mISDN_devinfo devinfo;
|
||||
unsigned int protocol, prop;
|
||||
|
||||
memset(&devinfo, 0, sizeof(devinfo));
|
||||
|
||||
/* check port counts */
|
||||
ret = ioctl(mISDNsocket, IMGETCOUNT, &cnt);
|
||||
if (ret < 0) {
|
||||
|
|
2
macro.h
2
macro.h
|
@ -115,6 +115,8 @@ static inline char *_getline(char *buffer, int size, FILE *fp)
|
|||
return buffer;
|
||||
if (buffer[strlen(buffer)-1] == '\n')
|
||||
buffer[strlen(buffer)-1] = '\0';
|
||||
if (!buffer[0])
|
||||
return buffer;
|
||||
if (buffer[strlen(buffer)-1] == '\r')
|
||||
buffer[strlen(buffer)-1] = '\0';
|
||||
return buffer;
|
||||
|
|
10
main.c
10
main.c
|
@ -549,16 +549,16 @@ free:
|
|||
debug_count++;
|
||||
join_free();
|
||||
|
||||
/* free interfaces */
|
||||
if (interface_first)
|
||||
free_interfaces(interface_first);
|
||||
interface_first = NULL;
|
||||
|
||||
#ifdef WITH_MISDN
|
||||
/* close isdn ports */
|
||||
mISDNport_close_all();
|
||||
#endif
|
||||
|
||||
/* free interfaces */
|
||||
if (interface_first)
|
||||
free_interfaces(interface_first);
|
||||
interface_first = NULL;
|
||||
|
||||
/* flush messages */
|
||||
debug_count++;
|
||||
i = 0;
|
||||
|
|
Loading…
Reference in New Issue