diff options
| author | Ben Kaduk <kaduk@mit.edu> | 2012-06-27 15:14:00 -0400 |
|---|---|---|
| committer | Ben Kaduk <kaduk@mit.edu> | 2012-07-02 18:47:16 -0400 |
| commit | e4a3c43c403a24fcf21a2a67eddf831032ab7ec4 (patch) | |
| tree | f473784b42f2b82d6ccf504feb398adf5cad8479 /src/appl | |
| parent | 203de6ef59348a41f2702dabd554c3f1b12cd5da (diff) | |
| download | krb5-e4a3c43c403a24fcf21a2a67eddf831032ab7ec4.tar.gz krb5-e4a3c43c403a24fcf21a2a67eddf831032ab7ec4.tar.xz krb5-e4a3c43c403a24fcf21a2a67eddf831032ab7ec4.zip | |
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.
Diffstat (limited to 'src/appl')
| -rw-r--r-- | src/appl/gss-sample/gss-server.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/appl/gss-sample/gss-server.c b/src/appl/gss-sample/gss-server.c index 2e56e06ab0..0f5fea0f81 100644 --- a/src/appl/gss-sample/gss-server.c +++ b/src/appl/gss-sample/gss-server.c @@ -893,7 +893,7 @@ showLocalIdentity(OM_uint32 *minor, gss_name_t name) major = gss_localname(minor, name, GSS_C_NO_OID, &localname); if (major == GSS_S_COMPLETE) - printf("localname: %-*s\n", localname.length, localname.value); + printf("localname: %-*s\n", (int)localname.length, localname.value); else if (major != GSS_S_UNAVAILABLE) display_status("gss_localname", major, *minor); gss_release_buffer(minor, &localname); |
