summaryrefslogtreecommitdiff
path: root/lib/libcurses/tinfo/write_entry.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-03-18 16:55:55 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-03-18 16:55:55 +0000
commitdfbb771c83664afc246a3834d4ec17f3169b5989 (patch)
treea6062cdd0136c3b4f82635b600a22a9bb6099569 /lib/libcurses/tinfo/write_entry.c
parent9504d3161dd42533b38ffc7e455b079baddb6032 (diff)
Use strlcpy() / strlcat() throughout.
Diffstat (limited to 'lib/libcurses/tinfo/write_entry.c')
-rw-r--r--lib/libcurses/tinfo/write_entry.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libcurses/tinfo/write_entry.c b/lib/libcurses/tinfo/write_entry.c
index 97be60e8abe..9aff48b5ef0 100644
--- a/lib/libcurses/tinfo/write_entry.c
+++ b/lib/libcurses/tinfo/write_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write_entry.c,v 1.11 2003/03/17 19:16:59 millert Exp $ */
+/* $OpenBSD: write_entry.c,v 1.12 2003/03/18 16:55:54 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -90,9 +90,8 @@ make_directory(const char *path)
const char *destination = _nc_tic_dir(0);
if (path == destination || *path == '/') {
- if (strlen(path) + 1 > sizeof(fullpath))
+ if (strlcpy(fullpath, path, sizeof(fullpath)) >= sizeof(fullpath))
return (-1);
- (void) strcpy(fullpath, path);
} else {
if (strlen(destination) + strlen(path) + 2 > sizeof(fullpath))
return (-1);
@@ -224,7 +223,7 @@ _nc_write_entry(TERMTYPE * const tp)
start_time = 0;
}
- (void) strcpy(name_list, tp->term_names);
+ (void) strlcpy(name_list, tp->term_names, sizeof(name_list));
DEBUG(7, ("Name list = '%s'", name_list));
first_name = name_list;
@@ -310,9 +309,8 @@ _nc_write_entry(TERMTYPE * const tp)
{
int code;
#if USE_SYMLINKS
- strcpy(symlinkname, "../");
- strncat(symlinkname, filename, sizeof(symlinkname) - 4);
- symlinkname[sizeof(symlinkname) - 1] = '\0';
+ strlcpy(symlinkname, "../", sizeof(symlinkname));
+ strlcat(symlinkname, filename, sizeof(symlinkname));
#endif /* USE_SYMLINKS */
#if HAVE_REMOVE
code = remove(linkname);