summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2013-03-25 22:31:34 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2013-03-25 22:31:34 (GMT)
commit4a595cff795dd657dba2b94d526463a7dd1526c4 (patch)
tree863cefb16506d189df20c70283b584a55eb8d425
parentea4c99de4cedf4623f3569dd48e153141950b78a (diff)
downloadffmpeg-4a595cff795dd657dba2b94d526463a7dd1526c4.zip
ffmpeg-4a595cff795dd657dba2b94d526463a7dd1526c4.tar.gz
ffmpeg-4a595cff795dd657dba2b94d526463a7dd1526c4.tar.bz2
ffserver/ctime1: avoid using strcpy()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--ffserver.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ffserver.c b/ffserver.c
index 8acd591..ac9627f 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -396,14 +396,14 @@ static int resolve_host(struct in_addr *sin_addr, const char *hostname)
return 0;
}
-static char *ctime1(char *buf2)
+static char *ctime1(char *buf2, int buf_size)
{
time_t ti;
char *p;
ti = time(NULL);
p = ctime(&ti);
- strcpy(buf2, p);
+ av_strlcpy(buf2, p, buf_size);
p = buf2 + strlen(p) - 1;
if (*p == '\n')
*p = '\0';
@@ -416,7 +416,7 @@ static void http_vlog(const char *fmt, va_list vargs)
if (logfile) {
if (print_prefix) {
char buf[32];
- ctime1(buf);
+ ctime1(buf, sizeof(buf));
fprintf(logfile, "%s ", buf);
}
print_prefix = strstr(fmt, "\n") != NULL;