From b8a9b321fab4582e128e723356a334a7e0d1cd29 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sun, 6 Apr 2003 21:38:55 +0000 Subject: [PATCH] Updated. committer: mfx 1049665135 +0000 --- src/msg.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/msg.cpp b/src/msg.cpp index 6299e449..88828d92 100644 --- a/src/msg.cpp +++ b/src/msg.cpp @@ -109,12 +109,15 @@ static void pr_error(const char *iname, const char *msg, bool is_warning) void printErr(const char *iname, const Throwable *e) { char buf[1024]; + size_t l; upx_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e).name())); - if (e->getMsg()) - upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),": %s", e->getMsg()); - if (e->getErrno()) - upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),": %s", strerror(e->getErrno())); + l = strlen(buf); + if (l < sizeof(buf) && e->getMsg()) + upx_snprintf(buf+l, sizeof(buf)-l, ": %s", e->getMsg()); + l = strlen(buf); + if (l < sizeof(buf) && e->getErrno()) + upx_snprintf(buf+l, sizeof(buf)-l, ": %s", strerror(e->getErrno())); pr_error(iname,buf,e->isWarning()); }