aboutsummaryrefslogtreecommitdiff
path: root/crypto/heimdal/lib/com_err/com_err.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/com_err/com_err.c')
-rw-r--r--crypto/heimdal/lib/com_err/com_err.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/heimdal/lib/com_err/com_err.c b/crypto/heimdal/lib/com_err/com_err.c
index ea0ac7c967f7..faf4294cdd8f 100644
--- a/crypto/heimdal/lib/com_err/com_err.c
+++ b/crypto/heimdal/lib/com_err/com_err.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: com_err.c,v 1.18 2002/03/10 23:07:01 assar Exp $");
+RCSID("$Id: com_err.c 14930 2005-04-24 19:43:06Z lha $");
#endif
#include <stdio.h>
#include <stdlib.h>
@@ -51,15 +51,14 @@ error_message (long code)
const char *p = com_right(_et_list, code);
if (p == NULL) {
if (code < 0)
- sprintf(msg, "Unknown error %ld", code);
+ snprintf(msg, sizeof(msg), "Unknown error %ld", code);
else
p = strerror(code);
}
if (p != NULL && *p != '\0') {
- strncpy(msg, p, sizeof(msg) - 1);
- msg[sizeof(msg) - 1] = 0;
+ strlcpy(msg, p, sizeof(msg));
} else
- sprintf(msg, "Unknown error %ld", code);
+ snprintf(msg, sizeof(msg), "Unknown error %ld", code);
return msg;
}