diff options
Diffstat (limited to 'usr/src/lib/krb5/ss/help.c')
-rw-r--r-- | usr/src/lib/krb5/ss/help.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/usr/src/lib/krb5/ss/help.c b/usr/src/lib/krb5/ss/help.c index 5979e45463..b5e4ef15f5 100644 --- a/usr/src/lib/krb5/ss/help.c +++ b/usr/src/lib/krb5/ss/help.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -13,13 +13,13 @@ #include <sys/param.h> #include <sys/types.h> +#include <errno.h> #include <sys/file.h> #include <fcntl.h> /* just for O_* */ #include <sys/wait.h> #include "ss_internal.h" #include "copyright.h" #include <libintl.h> -#include <errno.h> extern void ss_list_requests(); @@ -63,16 +63,18 @@ void ss_help (argc, argv, sci_idx, info_ptr) return; } for (idx = 0; info->info_dirs[idx] != (char *)NULL; idx++) { - (void) strcpy(buffer, info->info_dirs[idx]); - (void) strcat(buffer, "/"); - (void) strcat(buffer, argv[1]); - (void) strcat(buffer, ".info"); + (void) strncpy(buffer, info->info_dirs[idx], sizeof(buffer) - 1); + buffer[sizeof(buffer) - 1] = '\0'; + (void) strncat(buffer, "/", sizeof(buffer) - 1 - strlen(buffer)); + (void) strncat(buffer, argv[1], sizeof(buffer) - 1 - strlen(buffer)); + (void) strncat(buffer, ".info", sizeof(buffer) - 1 - strlen(buffer)); if ((fd = open(&buffer[0], O_RDONLY)) >= 0) goto got_it; } if ((fd = open(&buffer[0], O_RDONLY)) < 0) { char buf[MAXPATHLEN]; - strcpy(buf, "No info found for "); - strcat(buf, argv[1]); + strncpy(buf, "No info found for ", sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; + strncat(buf, argv[1], sizeof(buf) - 1 - strlen(buf)); ss_perror(sci_idx, 0, buf); return; } |