--- firebird-1.5.0.4290/src/lock/lock.cpp.orig 2003-11-25 07:37:57.000000000 +0100 +++ firebird-1.5.0.4290/src/lock/lock.cpp 2004-05-29 16:46:45.238245656 +0200 @@ -2027,7 +2027,7 @@ /* The lock file has some problem - copy it for later analysis */ { TEXT *lock_file; - TEXT buffer[2 * MAXPATHLEN]; + TEXT buffer[2 * MAXPATHLEN + 256]; TEXT buffer2[2 * MAXPATHLEN]; TEXT hostname[64]; gds__prefix_lock(buffer, LOCK_FILE); --- firebird-1.5.0.4290/src/jrd/gds.cpp.orig 2004-02-06 05:56:28.000000000 +0100 +++ firebird-1.5.0.4290/src/jrd/gds.cpp 2004-05-29 17:54:46.802753536 +0200 @@ -1573,7 +1573,10 @@ ib_prefix = ib_prefix_val; } } - strcat(resultString, ib_prefix); + /* beware of no length check after getenv() */ + if(strlen(ib_prefix) >= MAXPATHLEN) + resultString[MAXPATHLEN - 1] = 0; + strncat(resultString, ib_prefix, MAXPATHLEN - 1); safe_concat_path(resultString, file); } #endif /* !defined(VMS) */ @@ -1662,11 +1665,14 @@ #endif } else { - strcat(ib_prefix_lock_val, ib_prefix_lock); + ib_prefix_lock_val[MAXPATHLEN - 1] = 0; + strncpy(ib_prefix_lock_val, ib_prefix_lock, MAXPATHLEN - 1); ib_prefix_lock = ib_prefix_lock_val; } } - strcat(string, ib_prefix_lock); + if(strlen(ib_prefix_lock) >= MAXPATHLEN) + string[MAXPATHLEN - 1] = 0; + strncat(string, ib_prefix_lock, MAXPATHLEN - 1); safe_concat_path(string, root); } #endif @@ -1746,11 +1752,14 @@ gds__prefix(ib_prefix_msg, ""); } else { - strcat(ib_prefix_msg_val, ib_prefix_msg); + ib_prefix_msg_val[MAXPATHLEN - 1] = 0; + strncpy(ib_prefix_msg_val, ib_prefix_msg, MAXPATHLEN - 1); ib_prefix_msg = ib_prefix_msg_val; } } - strcat(string, ib_prefix_msg); + if(strlen(ib_prefix_msg) >= MAXPATHLEN) + string[MAXPATHLEN - 1] = 0; + strncat(string, ib_prefix_msg, MAXPATHLEN - 1); safe_concat_path(string, root); } #endif