diff --git a/src/sbbs3/js_file.c b/src/sbbs3/js_file.c index 9504d16c517f5e739a5e2343ef722a2b9b2a3eb5..b1091e17d6c7a919804ce3e8de20d5c187a9e57a 100644 --- a/src/sbbs3/js_file.c +++ b/src/sbbs3/js_file.c @@ -448,7 +448,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva char* section; char* key; char** list; - char buf[MAX_VALUE_LEN]; + char buf[INI_MAX_VALUE_LEN]; int32 i; jsval val; jsval dflt=argv[2]; diff --git a/src/sbbs3/sbbs_ini.c b/src/sbbs3/sbbs_ini.c index f61a673ecab9fea96b495ca6db8aad50af9a4e7a..b29f30bab92bd956cf004ae2a37a8d129fa08646 100644 --- a/src/sbbs3/sbbs_ini.c +++ b/src/sbbs3/sbbs_ini.c @@ -164,7 +164,7 @@ void sbbs_read_ini( char* ctrl_dir; char* temp_dir; char host_name[128]; - char value[MAX_VALUE_LEN]; + char value[INI_MAX_VALUE_LEN]; ulong interface_addr; ulong js_max_bytes; ushort sem_chk_freq; diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c index 80646153b59219b1a1469320510628bb2de59bfc..cc596d925ae430460c179eb5bc6ab30b5da71b02 100644 --- a/src/sbbs3/services.c +++ b/src/sbbs3/services.c @@ -1456,8 +1456,8 @@ static service_t* read_services_ini(service_t* service, char* services_ini, DWOR { uint i,j; FILE* fp; - char cmd[MAX_LINE_LEN+1]; - char host[MAX_LINE_LEN+1]; + char cmd[INI_MAX_VALUE_LEN]; + char host[INI_MAX_VALUE_LEN]; char** sec_list; service_t* np; service_t serv; diff --git a/src/xpdev/ini_file.c b/src/xpdev/ini_file.c index 425205c53eb096cbc9be1b2a320f732c81658349..ee7c9a680d1c0ee0aad57d665fbc76fb876404c9 100644 --- a/src/xpdev/ini_file.c +++ b/src/xpdev/ini_file.c @@ -41,6 +41,8 @@ #include "sockwrap.h" /* inet_addr */ #include "ini_file.h" +#define INI_MAX_LINE_LEN 256 /* Maximum length of entire line, includes '\0' */ + /****************************************************************************/ /* Truncates white-space chars off end of 'str' */ /****************************************************************************/ @@ -57,7 +59,7 @@ static BOOL find_section(FILE* fp, const char* section) { char* p; char* tp; - char str[MAX_LINE_LEN]; + char str[INI_MAX_LINE_LEN]; rewind(fp); @@ -83,7 +85,7 @@ static char* get_value(FILE* fp, const char* section, const char* key, char* val { char* p; char* tp; - char str[MAX_LINE_LEN]; + char str[INI_MAX_LINE_LEN]; if(fp==NULL) return(NULL); @@ -111,7 +113,7 @@ static char* get_value(FILE* fp, const char* section, const char* key, char* val p=tp+1; while(*p && *p<=' ') p++; truncsp(p); - sprintf(value,"%.*s",MAX_VALUE_LEN-1,p); + sprintf(value,"%.*s",INI_MAX_VALUE_LEN-1,p); return(value); } @@ -133,11 +135,11 @@ char** iniGetStringList(FILE* fp, const char* section, const char* key ,const char* sep, const char* deflt) { char* value; - char buf[MAX_VALUE_LEN]; + char buf[INI_MAX_VALUE_LEN]; char** lp; char** np; char* token; - char list[MAX_VALUE_LEN]; + char list[INI_MAX_VALUE_LEN]; ulong items=0; if((value=get_value(fp,section,key,buf))==NULL || *value==0 /* blank */) @@ -204,7 +206,7 @@ char** iniGetSectionList(FILE* fp, const char* prefix) char* tp; char** lp; char** np; - char str[MAX_LINE_LEN]; + char str[INI_MAX_LINE_LEN]; ulong items=0; if((lp=malloc(sizeof(char*)))==NULL) @@ -251,7 +253,7 @@ char** iniGetKeyList(FILE* fp, const char* section) char* tp; char** lp; char** np; - char str[MAX_LINE_LEN]; + char str[INI_MAX_LINE_LEN]; ulong items=0; if((lp=malloc(sizeof(char*)))==NULL) @@ -301,7 +303,7 @@ iniGetNamedStringList(FILE* fp, const char* section) char* name; char* value; char* tp; - char str[MAX_LINE_LEN]; + char str[INI_MAX_LINE_LEN]; ulong items=0; named_string_t** lp; named_string_t** np; @@ -362,7 +364,7 @@ iniGetNamedStringList(FILE* fp, const char* section) long iniGetInteger(FILE* fp, const char* section, const char* key, long deflt) { char* value; - char buf[MAX_VALUE_LEN]; + char buf[INI_MAX_VALUE_LEN]; if((value=get_value(fp,section,key,buf))==NULL) return(deflt); @@ -380,7 +382,7 @@ ushort iniGetShortInt(FILE* fp, const char* section, const char* key, ushort def ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong deflt) { - char buf[MAX_VALUE_LEN]; + char buf[INI_MAX_VALUE_LEN]; char* value; if((value=get_value(fp,section,key,buf))==NULL) @@ -397,7 +399,7 @@ ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong defl double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt) { - char buf[MAX_VALUE_LEN]; + char buf[INI_MAX_VALUE_LEN]; char* value; if((value=get_value(fp,section,key,buf))==NULL) @@ -411,7 +413,7 @@ double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt) BOOL iniGetBool(FILE* fp, const char* section, const char* key, BOOL deflt) { - char buf[MAX_VALUE_LEN]; + char buf[INI_MAX_VALUE_LEN]; char* value; if((value=get_value(fp,section,key,buf))==NULL) @@ -435,7 +437,7 @@ ulong iniGetBitField(FILE* fp, const char* section, const char* key, char* p; char* tp; char* value; - char buf[MAX_VALUE_LEN]; + char buf[INI_MAX_VALUE_LEN]; ulong v=0; if((value=get_value(fp,section,key,buf))==NULL) diff --git a/src/xpdev/ini_file.h b/src/xpdev/ini_file.h index 6d4dac24686e489b085f0a243dc2e256776e9650..2c8fedaecdf8242d2ae349d16d9144db5eef80a8 100644 --- a/src/xpdev/ini_file.h +++ b/src/xpdev/ini_file.h @@ -40,8 +40,7 @@ #include "genwrap.h" -#define MAX_LINE_LEN 256 /* Maximum length of entire line, includes '\0' */ -#define MAX_VALUE_LEN 128 /* Maximum value length, includes '\0' */ +#define INI_MAX_VALUE_LEN 128 /* Maximum value length, includes '\0' */ typedef struct { ulong bit;