From 4fe9ae7f760024fc53e0067e93594b7f8dd98803 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 30 Dec 2019 17:44:15 -0800 Subject: [PATCH] H316, Ibm1130, S3: Silence GCC warnings about potential format truncation --- H316/h316_udp.c | 3 ++- Ibm1130/ibm1130_sca.c | 6 +++--- S3/s3_sys.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/H316/h316_udp.c b/H316/h316_udp.c index ffda83de..150fcbb5 100644 --- a/H316/h316_udp.c +++ b/H316/h316_udp.c @@ -150,7 +150,7 @@ // One of these blocks is allocated for every simulated modem link. struct _UDP_LINK { t_bool used; // TRUE if this UDP_LINK is in use - char rhostport[64]; // Remote host:port + char rhostport[90]; // Remote host:port char lport[64]; // Local port uint32 rxsequence; // next message sequence number for receive uint32 txsequence; // next message sequence number for transmit @@ -217,6 +217,7 @@ t_stat udp_parse_remote (int32 link, const char *premote) // If the host name/IP is omitted then it defaults to "localhost". char *end; int32 lport, rport; char host[64], port[16]; + if (*premote == '\0') return SCPE_2FARG; memset (udp_links[link].lport, 0, sizeof(udp_links[link].lport)); memset (udp_links[link].rhostport, 0, sizeof(udp_links[link].rhostport)); diff --git a/Ibm1130/ibm1130_sca.c b/Ibm1130/ibm1130_sca.c index 05bff810..5fd4bed7 100644 --- a/Ibm1130/ibm1130_sca.c +++ b/Ibm1130/ibm1130_sca.c @@ -161,7 +161,7 @@ static uint32 sca_state = SCA_STATE_IDLE; static uint8 sichar = 0; /* sync/idle character */ static uint8 rcvd_char = 0; /* most recently received character */ static uint8 sca_frame = 8; -static char sca_port[CBUFSIZE]; /* listening port */ +static char sca_port[3*CBUFSIZE]; /* listening port */ static int32 sca_keepalive = 0; /* keepalive SYN packet period in msec, default = 0 (disabled) */ static SCA_TIMER_STATE sca_timer_state[3]; /* current timer state */ static int sca_timer_endtime[3]; /* clocktime when timeout is to occur if state is RUNNING */ @@ -295,7 +295,7 @@ char *mstring (const char *str) static void sca_socket_error (void) { - char name[100]; + char name[4*CBUFSIZE]; /* print diagnostic? */ printf("SCA socket error, closing connection\n"); @@ -452,7 +452,7 @@ static t_stat sca_attach (UNIT *uptr, CONST char *cptr) { char host[CBUFSIZE], port[CBUFSIZE]; t_bool do_listen; - char name[CBUFSIZE]; + char name[4*CBUFSIZE]; t_stat r; do_listen = sim_switches & SWMASK('L'); /* -l means listen mode */ diff --git a/S3/s3_sys.c b/S3/s3_sys.c index 4f027b10..50f58ff5 100644 --- a/S3/s3_sys.c +++ b/S3/s3_sys.c @@ -272,7 +272,7 @@ int32 printf_sym (FILE *of, char *strg, t_addr addr, uint32 *val, { int32 c1, c2, group, len1, len2, inst, aaddr, baddr; int32 oplen, groupno, i, j, vpos, qbyte, da, m, n; -char bld[128], bldaddr[32], boperand[32], aoperand[32]; +char bld[128], bldaddr[96], boperand[32], aoperand[32]; int32 blk[16], blt[16]; int32 blkadd;