summaryrefslogtreecommitdiff
path: root/lib/libcurses/tinfo/read_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/read_entry.c
parent9504d3161dd42533b38ffc7e455b079baddb6032 (diff)
Use strlcpy() / strlcat() throughout.
Diffstat (limited to 'lib/libcurses/tinfo/read_entry.c')
-rw-r--r--lib/libcurses/tinfo/read_entry.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libcurses/tinfo/read_entry.c b/lib/libcurses/tinfo/read_entry.c
index 8c31ca39dd3..cfd9272d95f 100644
--- a/lib/libcurses/tinfo/read_entry.c
+++ b/lib/libcurses/tinfo/read_entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read_entry.c,v 1.13 2003/03/17 19:16:59 millert Exp $ */
+/* $OpenBSD: read_entry.c,v 1.14 2003/03/18 16:55:54 millert Exp $ */
/****************************************************************************
* Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. *
@@ -158,6 +158,7 @@ read_termtype(int fd, TERMTYPE * ptr)
{
int name_size, bool_count, num_count, str_count, str_size;
int i;
+ size_t bsize;
char buf[MAX_ENTRY_SIZE];
TR(TRACE_DATABASE, ("READ termtype header @%d", tell(fd)));
@@ -202,11 +203,12 @@ read_termtype(int fd, TERMTYPE * ptr)
/* grab the name (a null-terminate string) */
read(fd, buf, min(MAX_NAME_SIZE, (unsigned) name_size));
buf[MAX_NAME_SIZE] = '\0';
- ptr->term_names = typeCalloc(char, strlen(buf) + 1);
+ bsize = strlen(buf) + 1;
+ ptr->term_names = typeCalloc(char, bsize);
if (ptr->term_names == NULL) {
return (0);
}
- (void) strcpy(ptr->term_names, buf);
+ (void) strlcpy(ptr->term_names, buf, bsize);
if (name_size > MAX_NAME_SIZE)
lseek(fd, (off_t) (name_size - MAX_NAME_SIZE), 1);