diff options
author | Greg Hudson <ghudson@mit.edu> | 2008-12-01 17:09:59 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2008-12-01 17:09:59 +0000 |
commit | 0692bffad6dbd696b2817f59ee7dd2e7e38ceb4b (patch) | |
tree | 3ab0a7b22c93fd929b1f532e98618d62f1a848d9 /src/appl/sample | |
parent | 689e929e5e0240684408bb0bc53d536f5696cdea (diff) | |
download | krb5-0692bffad6dbd696b2817f59ee7dd2e7e38ceb4b.zip krb5-0692bffad6dbd696b2817f59ee7dd2e7e38ceb4b.tar.gz krb5-0692bffad6dbd696b2817f59ee7dd2e7e38ceb4b.tar.bz2 |
Convert many uses of sprintf to snprintf or asprintf
ticket: 6200
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21258 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl/sample')
-rw-r--r-- | src/appl/sample/sserver/sserver.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/appl/sample/sserver/sserver.c b/src/appl/sample/sserver/sserver.c index 2cb971b..39710fb 100644 --- a/src/appl/sample/sserver/sserver.c +++ b/src/appl/sample/sserver/sserver.c @@ -210,12 +210,15 @@ main(argc, argv) } /* Get client name */ + repbuf[sizeof(repbuf) - 1] = '\0'; retval = krb5_unparse_name(context, ticket->enc_part2->client, &cname); if (retval){ syslog(LOG_ERR, "unparse failed: %s", error_message(retval)); - sprintf(repbuf, "You are <unparse error>\n"); + strncpy(repbuf, "You are <unparse error>\n", sizeof(repbuf) - 1); } else { - sprintf(repbuf, "You are %s\n", cname); + strncpy(repbuf, "You are ", sizeof(repbuf) - 1); + strncat(repbuf, cname, sizeof(repbuf) - 1 - strlen(repbuf)); + strncat(repbuf, "\n", sizeof(repbuf) - 1 - strlen(repbuf)); free(cname); } xmitlen = htons(strlen(repbuf)); |