Skip to content
Snippets Groups Projects
Commit f327310d authored by rswindell's avatar rswindell
Browse files

Define and use MAX_TEXTDAT_LINE_LEN (2000 chars):

This resolves JasHud's issue with question text.dat items over > 128 chars
being truncated.
parent db181702
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
/****************************************************************************/
char *readtext(long *line,FILE *stream,long dflt)
{
char buf[2048],str[2048],tmp[256],*p,*p2;
char buf[MAX_TEXTDAT_ITEM_LEN+256],str[MAX_TEXTDAT_ITEM_LEN+1],tmp[256],*p,*p2;
int i,j,k;
if(!fgets(buf,256,stream)) {
......@@ -27,7 +27,7 @@ char *readtext(long *line,FILE *stream,long dflt)
goto use_default;
}
if(*(p+1)=='\\') /* merge multiple lines */
while(strlen(buf)<2000) {
while(strlen(buf)<MAX_TEXTDAT_ITEM_LEN) {
if(!fgets(str,255,stream)) {
/* Hide the EOF */
if(feof(stream))
......@@ -47,7 +47,7 @@ char *readtext(long *line,FILE *stream,long dflt)
}
*(p)=0;
k=strlen(buf);
for(i=1,j=0;i<k;j++) {
for(i=1,j=0;i<k && j<sizeof(str)-1;j++) {
if(buf[i]=='\\') { /* escape */
i++;
if(isdigit(buf[i])) {
......
......@@ -538,7 +538,7 @@ public:
char getkey(long mode); /* Waits for a key hit local or remote */
long getkeys(const char *str, ulong max);
void ungetkey(char ch); /* Places 'ch' into the input buffer */
char question[128];
char question[MAX_TEXTDAT_ITEM_LEN+1];
bool yesno(const char *str);
bool noyes(const char *str);
void pause(void);
......
......@@ -99,6 +99,8 @@ typedef struct {
#define MAX_FILES 10000 /* Maximum number of files per dir */
#define MAX_USERXFER 500 /* Maximum number of dest. users of usrxfer */
#define MAX_TEXTDAT_ITEM_LEN 2000
#define LEN_DIR 63 /* Maximum length of directory paths */
#define LEN_CMD 63 /* Maximum length of command lines */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment