Commit 05420b440b62ed7a8baa4b488789b0734e4c00b9

Authored by Perry Werneck
1 parent c24fe1f7
Exists in master and in 1 other branch develop

Fixing more CodeQL alerts.

src/core/ft/ft.c
@@ -474,7 +474,7 @@ LIB3270_EXPORT int lib3270_ft_start(H3270 *hSession) { @@ -474,7 +474,7 @@ LIB3270_EXPORT int lib3270_ft_start(H3270 *hSession) {
474 // Erase the line and enter the command. 474 // Erase the line and enter the command.
475 flen = kybd_prime(ft->host); 475 flen = kybd_prime(ft->host);
476 if (!flen || flen < strlen(buffer) - 1) { 476 if (!flen || flen < strlen(buffer) - 1) {
477 - lib3270_write_log(ft->host, "Unable to send command \"%s\" (flen=%d szBuffer=%d)",buffer,flen,strlen(buffer)); 477 + lib3270_write_log(ft->host, "ft", "Unable to send command \"%s\" (flen=%d szBuffer=%ld)",buffer,flen,strlen(buffer));
478 ft_failed(ft,_( "Unable to send file-transfer request" )); 478 ft_failed(ft,_( "Unable to send file-transfer request" ));
479 return errno = EINVAL; 479 return errno = EINVAL;
480 } 480 }
src/core/ft/ft_dft.c
@@ -383,7 +383,7 @@ static void dft_get_request(H3270 *hSession) { @@ -383,7 +383,7 @@ static void dft_get_request(H3270 *hSession) {
383 /* Binary read. */ 383 /* Binary read. */
384 numread = fread(bufptr, 1, numbytes, ft->local_file); 384 numread = fread(bufptr, 1, numbytes, ft->local_file);
385 if (numread <= 0) { 385 if (numread <= 0) {
386 - lib3270_write_log(hSession,"Error %s reading source file (rc=%d)",strerror(errno),errno); 386 + lib3270_write_log(hSession,"ft","Error %s reading source file (rc=%d)",strerror(errno),errno);
387 break; 387 break;
388 } 388 }
389 389
src/core/see.c
@@ -293,24 +293,24 @@ static const char * see_validation(unsigned char setting) { @@ -293,24 +293,24 @@ static const char * see_validation(unsigned char setting) {
293 293
294 (void) strcpy(buf, ""); 294 (void) strcpy(buf, "");
295 if (setting & XAV_FILL) { 295 if (setting & XAV_FILL) {
296 - (void) strcat(buf, paren);  
297 - (void) strcat(buf, "fill"); 296 + (void) strncat(buf, paren, 63);
  297 + (void) strncat(buf, "fill");
298 paren = ","; 298 paren = ",";
299 } 299 }
300 if (setting & XAV_ENTRY) { 300 if (setting & XAV_ENTRY) {
301 - (void) strcat(buf, paren);  
302 - (void) strcat(buf, "entry"); 301 + (void) strncat(buf, paren, 63);
  302 + (void) strncat(buf, "entry");
303 paren = ","; 303 paren = ",";
304 } 304 }
305 if (setting & XAV_TRIGGER) { 305 if (setting & XAV_TRIGGER) {
306 - (void) strcat(buf, paren);  
307 - (void) strcat(buf, "trigger"); 306 + (void) strncat(buf, paren, 63);
  307 + (void) strncat(buf, "trigger");
308 paren = ","; 308 paren = ",";
309 } 309 }
310 if (strcmp(paren, "(")) 310 if (strcmp(paren, "("))
311 - (void) strcat(buf, ")"); 311 + (void) strncat(buf, ")", 63);
312 else 312 else
313 - (void) strcpy(buf, "(none)"); 313 + (void) strncpy(buf, "(none)", 63);
314 return buf; 314 return buf;
315 } 315 }
316 316