diff --git a/scp.c b/scp.c index fefd3328..a460b173 100644 --- a/scp.c +++ b/scp.c @@ -2027,7 +2027,7 @@ for (i = 1; i < argc; i++) { /* loop thru args */ return 0; } if (*cbuf) /* concat args */ - strcat (cbuf, " "); + sim_strlcat (cbuf, " ", sizeof(cbuf)); sprintf(&cbuf[strlen(cbuf)], "%s%s%s", strchr(argv[i], ' ') ? "\"" : "", argv[i], strchr(argv[i], ' ') ? "\"" : ""); lookswitch = FALSE; /* no more switches */ } @@ -2113,7 +2113,7 @@ else if (*argv[0]) { /* sim name arg? */ strncpy (nbuf + 1, argv[0], PATH_MAX + 1); /* copy sim name */ if ((np = (char *)match_ext (nbuf, "EXE"))) /* remove .exe */ *np = 0; - strcat (nbuf, ".ini\""); /* add .ini" */ + sim_strlcat (nbuf, ".ini\"", sizeof(nbuf)); /* add .ini" */ stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* proc default cmd file */ if (stat == SCPE_OPENERR) { /* didn't exist/can't open? */ np = strrchr (nbuf, '/'); /* stript path and try again in cwd */ @@ -2906,7 +2906,7 @@ for (nargs = 0; nargs < 10; ) { /* extract arguments */ if (do_arg [0] == NULL) /* need at least 1 */ return SCPE_2FARG; if ((fpin = fopen (do_arg[0], "r")) == NULL) { /* file failed to open? */ - strcat (strcpy (cbuf, do_arg[0]), ".sim"); /* try again with .sim extension */ + sim_strlcat (strcpy (cbuf, do_arg[0]), ".sim", sizeof(cbuf));/* try again with .sim extension */ if ((fpin = fopen (cbuf, "r")) == NULL) { /* failed a second time? */ if (flag == 0) /* cmd line file? */ fprintf (stderr, "Can't open file %s\n", do_arg[0]); @@ -5076,19 +5076,19 @@ strcpy (WildName, cptr); cptr = WildName; sim_trim_endspc (WildName); if ((!stat (WildName, &filestat)) && (filestat.st_mode & S_IFDIR)) - strcat (WildName, "/*"); + sim_strlcat (WildName, "/*", sizeof(WildName)); if ((*cptr != '/') || (0 == memcmp (cptr, "./", 2)) || (0 == memcmp (cptr, "../", 3))) { #if defined (VMS) getcwd (WholeName, PATH_MAX, 0); #else getcwd (WholeName, PATH_MAX); #endif - strcat (WholeName, "/"); - strcat (WholeName, cptr); + sim_strlcat (WholeName, "/", sizeof(WholeName)); + sim_strlcat (WholeName, cptr, sizeof(WholeName)); sim_trim_endspc (WholeName); } else - strcpy (WholeName, cptr); + sim_strlcpy (WholeName, cptr, sizeof(WholeName)); while ((c = strstr (WholeName, "/./"))) memmove (c + 1, c + 3, 1 + strlen (c + 3)); while ((c = strstr (WholeName, "//"))) diff --git a/sim_console.c b/sim_console.c index 47f9f501..b8f3ab4d 100644 --- a/sim_console.c +++ b/sim_console.c @@ -3598,8 +3598,8 @@ static t_stat sim_os_ttinit (void) { SIOUXSettings.toppixel = 42; SIOUXSettings.leftpixel = 6; iBeamCursorH = GetCursor(iBeamCursor); - strcat(title, sim_name); - strcat(title, " Simulator"); + sim_strlcat(title, sim_name, sizeof(title)); + sim_strlcat(title, " Simulator", sizeof(title)); title[0] = strlen(title) - 1; /* Pascal string done */ for (i = 0; i <= title[0]; i++) { /* copy to unsigned char */ ptitle[i] = title[i]; diff --git a/sim_ether.c b/sim_ether.c index 4b7b25d6..bd9392c6 100644 --- a/sim_ether.c +++ b/sim_ether.c @@ -1144,7 +1144,7 @@ int load_pcap(void) { char npcap_path[512] = ""; if (p_GetSystemDirectory (npcap_path, sizeof(npcap_path) - 7)) - strcat (npcap_path, "\\Npcap"); + sim_strlcat (npcap_path, "\\Npcap", sizeof(npcap_path)); if (p_SetDllDirectory(npcap_path)) hLib = LoadLibraryA(lib_name); p_SetDllDirectory (NULL);