From 0119f9a9718cb48f380ef53cd4026a299484c0c0 Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Thu, 17 Feb 2011 21:35:21 +0000 Subject: [PATCH] create 2nd strschg_environ(): one with control length of string, second without this check --- goldlib/gall/gfilutl1.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/goldlib/gall/gfilutl1.cpp b/goldlib/gall/gfilutl1.cpp index dc7dbc5..6a8aae6 100644 --- a/goldlib/gall/gfilutl1.cpp +++ b/goldlib/gall/gfilutl1.cpp @@ -443,7 +443,20 @@ int strschg_environ(char* s) { std::string __s = s; int rv = strschg_environ(__s); // Look in gfilutl2.cpp if(rv) - strxcpy(s, __s.c_str(), sizeof(Path)); + strcpy(s, __s.c_str()); + return rv; +} + +int strschg_environ(char* s, size_t s_size) { + + if(s == NULL) return 0; + if(*s == NUL) + return 0; + + std::string __s = s; + int rv = strschg_environ(__s); // Look in gfilutl2.cpp + if(rv) + strxcpy(s, __s.c_str(), s_size); return rv; }