From 39671a069c30f6cc508de7692f49a01f413a5a16 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 7 Oct 2015 16:06:25 +0200 Subject: [PATCH] cs_errmsg never writes to static buffer For the CSYSERR applications should check errno themselves --- src/comstack.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/comstack.c b/src/comstack.c index 066fafd..9d46728 100644 --- a/src/comstack.c +++ b/src/comstack.c @@ -35,16 +35,8 @@ static const char *cs_errlist[] = const char *cs_errmsg(int n) { - static char buf[250]; - - if (n < CSNONE || n > CSLASTERROR) { - sprintf(buf, "unknown comstack error %d", n); - return buf; - } - if (n == CSYSERR) { - sprintf(buf, "%s: %s", cs_errlist[n], strerror(errno)); - return buf; - } + if (n < CSNONE || n > CSLASTERROR) + n = CSNONE; return cs_errlist[n]; } -- 1.7.10.4