Fix off by one error.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5529 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -57,8 +57,8 @@ error_message (long code)
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
p = strerror(code);
|
p = strerror(code);
|
||||||
if (p != NULL && *p != '\0') {
|
if (p != NULL && *p != '\0') {
|
||||||
strncpy(msg, p, sizeof(msg));
|
strncpy(msg, p, sizeof(msg) - 1);
|
||||||
msg[sizeof(msg)] = 0;
|
msg[sizeof(msg) - 1] = 0;
|
||||||
} else
|
} else
|
||||||
sprintf(msg, "Unknown error %ld", code);
|
sprintf(msg, "Unknown error %ld", code);
|
||||||
return msg;
|
return msg;
|
||||||
|
Reference in New Issue
Block a user