From d468f9d8d5edc2e3e26e20a594a300b8ee64cda4 Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Thu, 8 Dec 2005 18:48:15 +0000 Subject: [PATCH] Prevent buffer overflow --- goldlib/gcfg/gxfm116.cpp | 3 ++- goldlib/gcfg/gxinter.cpp | 3 ++- goldlib/gcfg/gxqecho.cpp | 3 ++- goldlib/gcfg/gxxbbs.cpp | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/goldlib/gcfg/gxfm116.cpp b/goldlib/gcfg/gxfm116.cpp index 6fc0225..3ddd416 100644 --- a/goldlib/gcfg/gxfm116.cpp +++ b/goldlib/gcfg/gxfm116.cpp @@ -247,7 +247,8 @@ void gareafile::ReadFMail(char* tag) { Path path, file; *file = NUL; - strcpy(options, tag); + options[79] = 0; + strncpy(options, tag, 79); ptr = strtok(tag, " \t"); while(ptr) { if(*ptr != '-') { diff --git a/goldlib/gcfg/gxinter.cpp b/goldlib/gcfg/gxinter.cpp index 7da3cf0..1a8b131 100644 --- a/goldlib/gcfg/gxinter.cpp +++ b/goldlib/gcfg/gxinter.cpp @@ -41,7 +41,8 @@ void gareafile::ReadInterMail(char* tag) { char options[80]; *_path = NUL; - strcpy(options, tag); + options[79] = 0; + strncpy(options, tag, 79); char* ptr = strtok(tag, " \t"); while(ptr) { diff --git a/goldlib/gcfg/gxqecho.cpp b/goldlib/gcfg/gxqecho.cpp index 83da5a7..33b8a85 100644 --- a/goldlib/gcfg/gxqecho.cpp +++ b/goldlib/gcfg/gxqecho.cpp @@ -96,7 +96,8 @@ void gareafile::ReadQEcho(char* tag) { *origin = NUL; *file = NUL; - strcpy(options, tag); + options[79] = 0; + strncpy(options, tag, 79); char* ptr = strtok(tag, " \t"); while(ptr) { if(*ptr != '-') diff --git a/goldlib/gcfg/gxxbbs.cpp b/goldlib/gcfg/gxxbbs.cpp index 694711d..6dfafb6 100644 --- a/goldlib/gcfg/gxxbbs.cpp +++ b/goldlib/gcfg/gxxbbs.cpp @@ -161,8 +161,9 @@ void gareafile::ReadAdeptXBBS(char* tag) { Path file, path, cfg; *path = NUL; + options[79] = 0; strcpy(cfg, "System\\Message_Areas"); - strcpy(options, tag); + strncpy(options, tag, 79); char* ptr = strtok(tag, " \t"); while(ptr) { if(*ptr != '-')