use strlcpy
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@61 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
4a5f12d4fe
commit
ab8fc6018c
2
Makefile
2
Makefile
|
@ -10,7 +10,7 @@ CC = gcc
|
|||
LDFLAGS =
|
||||
CFLAGS = -g3 $(optimize) -Wall $(DEFS)
|
||||
DEFS = -DVERSION=\"$(VERSION)\"
|
||||
SRCS = virus.c ttyrec.c dgamelaunch.c io.c ttyplay.c stripgfx.c
|
||||
SRCS = virus.c ttyrec.c dgamelaunch.c io.c ttyplay.c stripgfx.c strlcpy.c
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
LIBS = -lncurses -lcrypt -lutil
|
||||
|
||||
|
|
|
@ -314,14 +314,14 @@ populate_games (int *l)
|
|||
*replacestr = '\0';
|
||||
|
||||
games[len]->name = malloc (strlen (pdirent->d_name) + 1);
|
||||
strncpy (games[len]->name, pdirent->d_name,
|
||||
strlcpy (games[len]->name, pdirent->d_name,
|
||||
strlen (pdirent->d_name) + 1);
|
||||
|
||||
games[len]->date = malloc (11);
|
||||
strncpy (games[len]->date, replacestr + 1, 10);
|
||||
strlcpy (games[len]->date, replacestr + 1, 11);
|
||||
|
||||
games[len]->time = malloc (9);
|
||||
strncpy (games[len]->time, replacestr + 12, 8);
|
||||
strlcpy (games[len]->time, replacestr + 12, 9);
|
||||
|
||||
games[len]->idle_time = pstat.st_mtime;
|
||||
|
||||
|
|
|
@ -71,4 +71,7 @@ extern void write_canned_rcfile (char *target);
|
|||
extern void editoptions (void);
|
||||
extern void writefile (int requirenew);
|
||||
|
||||
/* strlcpy.c */
|
||||
extern size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue