From e4a3c43c403a24fcf21a2a67eddf831032ab7ec4 Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Wed, 27 Jun 2012 15:14:00 -0400 Subject: Improve printf handling of size_t args The %*s format takes two arguments, a precision length/width and an actual string; the length is specified as a signed integer. The size_t length field of the gss_buffer_desc type is an unsigned type, which must be cast or otherwise converted to a signed type to match the format string expectations. I do not think that the length will approach SIZE_T_MAX in practice, due to buffer constraints, so do not include handling for the edge case. There is a '%zu' format string for printing size_ts, but it is not available everywhere (e.g., AIX). Instead, use the unsigned long long abomination. --- src/lib/rpc/auth_gssapi_misc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/rpc/auth_gssapi_misc.c b/src/lib/rpc/auth_gssapi_misc.c index e1f92053d..53bdb983c 100644 --- a/src/lib/rpc/auth_gssapi_misc.c +++ b/src/lib/rpc/auth_gssapi_misc.c @@ -183,7 +183,7 @@ static void auth_gssapi_display_status_1( putc ('\n', stderr); if (misc_debug_gssapi) gssrpcint_printf("GSS-API authentication error %s: %*s\n", - m, msg.length, (char *) msg.value); + m, (int)msg.length, (char *) msg.value); (void) gss_release_buffer(&minor_stat, &msg); if (!msg_ctx) @@ -296,8 +296,9 @@ bool_t auth_gssapi_unwrap_data( if (*major != GSS_S_COMPLETE) return FALSE; - PRINTF(("gssapi_unwrap_data: %d bytes data, %d bytes sealed\n", - out_buf.length, in_buf.length)); + PRINTF(("gssapi_unwrap_data: %llu bytes data, %llu bytes sealed\n", + (unsigned long long)out_buf.length, + (unsigned long long)in_buf.length)); xdrmem_create(&temp_xdrs, out_buf.value, out_buf.length, XDR_DECODE); -- cgit