From: Tom Yu Date: Mon, 12 Dec 2011 20:45:58 +0000 (+0000) Subject: kfw fixes: fix _snprintf usage; use full error code in leash_error_message X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cccd1185deda696b2144e149ab0f44d267119d43;p=krb5.git kfw fixes: fix _snprintf usage; use full error code in leash_error_message Signed-off-by: Kevin Wasserman ticket: 7050 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25562 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/leashdll/lshfunc.c b/src/windows/leashdll/lshfunc.c index 6f2756672..1a0bf1430 100644 --- a/src/windows/leashdll/lshfunc.c +++ b/src/windows/leashdll/lshfunc.c @@ -68,7 +68,7 @@ leash_error_message( { char message[2048]; char *p = message; - int size = sizeof(message); + int size = sizeof(message) - 1; /* -1 to leave room for NULL terminator */ int n; // XXX: ignore AFS for now. @@ -85,7 +85,7 @@ leash_error_message( n = _snprintf(p, size, "Kerberos 5: %s (error %ld)\n", perror_message(rc5), - rc5 & 255 // XXX: & 255??!!! + rc5 ); p += n; size -= n; @@ -109,6 +109,7 @@ leash_error_message( size -= n; } #ifdef USE_MESSAGE_BOX + *p = 0; /* ensure NULL termination of message */ if ( displayMB ) MessageBox(NULL, message, "Leash", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND);