Prevent buffer overflow

This commit is contained in:
Stas Degteff 2005-12-08 18:48:15 +00:00
parent 2beffbd118
commit d468f9d8d5
4 changed files with 8 additions and 4 deletions

View File

@ -247,7 +247,8 @@ void gareafile::ReadFMail(char* tag) {
Path path, file; Path path, file;
*file = NUL; *file = NUL;
strcpy(options, tag); options[79] = 0;
strncpy(options, tag, 79);
ptr = strtok(tag, " \t"); ptr = strtok(tag, " \t");
while(ptr) { while(ptr) {
if(*ptr != '-') { if(*ptr != '-') {

View File

@ -41,7 +41,8 @@ void gareafile::ReadInterMail(char* tag) {
char options[80]; char options[80];
*_path = NUL; *_path = NUL;
strcpy(options, tag); options[79] = 0;
strncpy(options, tag, 79);
char* ptr = strtok(tag, " \t"); char* ptr = strtok(tag, " \t");
while(ptr) { while(ptr) {

View File

@ -96,7 +96,8 @@ void gareafile::ReadQEcho(char* tag) {
*origin = NUL; *origin = NUL;
*file = NUL; *file = NUL;
strcpy(options, tag); options[79] = 0;
strncpy(options, tag, 79);
char* ptr = strtok(tag, " \t"); char* ptr = strtok(tag, " \t");
while(ptr) { while(ptr) {
if(*ptr != '-') if(*ptr != '-')

View File

@ -161,8 +161,9 @@ void gareafile::ReadAdeptXBBS(char* tag) {
Path file, path, cfg; Path file, path, cfg;
*path = NUL; *path = NUL;
options[79] = 0;
strcpy(cfg, "System\\Message_Areas"); strcpy(cfg, "System\\Message_Areas");
strcpy(options, tag); strncpy(options, tag, 79);
char* ptr = strtok(tag, " \t"); char* ptr = strtok(tag, " \t");
while(ptr) { while(ptr) {
if(*ptr != '-') if(*ptr != '-')