Enlarge the buffer size for command 'listing' from 512 to 4096 bytes.

This commit is contained in:
Holger Vogt 2020-10-28 11:37:58 +01:00
parent 3e98cecd56
commit dd86bdee46
2 changed files with 6 additions and 3 deletions

View File

@ -184,11 +184,13 @@ com_listing(wordlist *wl)
static char * static char *
upper(char *string) upper(char *string)
{ {
static char buf[BSIZE_SP]; static char buf[LBSIZE_SP];
if (string) { if (string) {
strncpy(buf, string, BSIZE_SP - 1); if (strlen(string) > LBSIZE_SP - 1)
buf[BSIZE_SP - 1] = '\0'; fprintf(stderr, "Warning: output of command 'listing' will be truncated\n");
strncpy(buf, string, LBSIZE_SP - 1);
buf[LBSIZE_SP - 1] = '\0';
inp_casefix(buf); inp_casefix(buf);
} else { } else {
strcpy(buf, "<null>"); strcpy(buf, "<null>");

View File

@ -114,6 +114,7 @@
#endif #endif
#define BSIZE_SP 512 #define BSIZE_SP 512
#define LBSIZE_SP 4096
#define EXIT_NORMAL 0 #define EXIT_NORMAL 0