From: Ken Raeburn Date: Thu, 12 Jul 2007 23:34:04 +0000 (+0000) Subject: Avoid unchecked sprintf in some more support code X-Git-Tag: krb5-1.7-alpha1~1008 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b06170f99a8f869b3ac1c3832d44c09d0f59e70f;p=krb5.git Avoid unchecked sprintf in some more support code git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19704 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/libpty/update_utmp.c b/src/appl/libpty/update_utmp.c index d2de6428f..8f3d6a66c 100644 --- a/src/appl/libpty/update_utmp.c +++ b/src/appl/libpty/update_utmp.c @@ -550,9 +550,9 @@ pty_update_utmp(int process_type, int pid, const char *username, strcpy(utmp_id, cp); #else if (len > 2 && *(cp - 1) != '/') - sprintf(utmp_id, "k%s", cp - 1); + snprintf(utmp_id, sizeof(utmp_id), "k%s", cp - 1); else - sprintf(utmp_id, "k0%s", cp); + snprintf(utmp_id, sizeof(utmp_id), "k0%s", cp); #endif strncpy(utx.ut_id, utmp_id, sizeof(utx.ut_id)); /* diff --git a/src/util/ss/help.c b/src/util/ss/help.c index 2752f40ed..019939795 100644 --- a/src/util/ss/help.c +++ b/src/util/ss/help.c @@ -38,8 +38,9 @@ void ss_help (argc, argv, sci_idx, info_ptr) } else if (argc != 2) { /* should do something better than this */ - sprintf(buffer, "usage:\n\t%s [topic|command]\nor\t%s\n", - request_name, request_name); + snprintf(buffer, sizeof(buffer), + "usage:\n\t%s [topic|command]\nor\t%s\n", + request_name, request_name); ss_perror(sci_idx, 0, buffer); return; }