Commit cb15dc24 authored by Lehner Florian's avatar Lehner Florian

fix issues caused by replaceing strcpy() with safe_strncpy()

Signed-off-by: default avatarLehner Florian <dev@der-flo.net>
parent 604785ad
...@@ -109,14 +109,15 @@ int rprint_fib(int ext, int numeric) ...@@ -109,14 +109,15 @@ int rprint_fib(int ext, int numeric)
sin_netmask = (struct sockaddr_in *)&snet_mask; sin_netmask = (struct sockaddr_in *)&snet_mask;
safe_strncpy(net_addr, INET_sprintmask(&snet_target, safe_strncpy(net_addr, INET_sprintmask(&snet_target,
(numeric | 0x8000 | (iflags & RTF_HOST? 0x4000: 0)), (numeric | 0x8000 | (iflags & RTF_HOST? 0x4000: 0)),
sin_netmask->sin_addr.s_addr), sin_netmask->sin_addr.s_addr), sizeof(net_addr));
sizeof(net_addr)); net_addr[15] = '\0';
safe_strncpy(gate_addr, inet_aftype.sprint(&snet_gateway, numeric | 0x4000), safe_strncpy(gate_addr, inet_aftype.sprint(&snet_gateway, numeric | 0x4000),
sizeof(gate_addr)); sizeof(gate_addr));
gate_addr[15] = '\0';
safe_strncpy(mask_addr, inet_aftype.sprint(&snet_mask, 1), safe_strncpy(mask_addr, inet_aftype.sprint(&snet_mask, 1), sizeof(mask_addr));
sizeof(mask_addr)); mask_addr[15] = '\0';
/* Decode the flags. */ /* Decode the flags. */
flags[0] = '\0'; flags[0] = '\0';
......
...@@ -136,10 +136,8 @@ int main(int argc, char **argv) ...@@ -136,10 +136,8 @@ int main(int argc, char **argv)
/* getopts and -net wont work :-/ */ /* getopts and -net wont work :-/ */
for (tmp = argv; *tmp; tmp++) { for (tmp = argv; *tmp; tmp++) {
if (!strcmp(*tmp, "-net")) if (!strcmp(*tmp, "-net") || !strcmp(*tmp, "-host"))
safe_strncpy(*tmp, "#net", sizeof(*tmp)); (*tmp)[0]='#';
else if (!strcmp(*tmp, "-host"))
safe_strncpy(*tmp, "#host", sizeof(*tmp));
} }
/* Fetch the command-line arguments. */ /* Fetch the command-line arguments. */
......
...@@ -609,7 +609,7 @@ version(void) ...@@ -609,7 +609,7 @@ version(void)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char path_buf[128]; char path_buf[128] = "";
char *path_dev; char *path_dev;
char buff[128]; char buff[128];
const char *speed = NULL; const char *speed = NULL;
...@@ -621,7 +621,6 @@ main(int argc, char *argv[]) ...@@ -621,7 +621,6 @@ main(int argc, char *argv[])
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
safe_strncpy(path_buf, "", sizeof(path_buf));
path_dev = path_buf; path_dev = path_buf;
/* Scan command line for any arguments. */ /* Scan command line for any arguments. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment