]> git.sesse.net Git - ffmpeg/commitdiff
ffserver/ctime1: avoid using strcpy()
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 25 Mar 2013 22:31:34 +0000 (23:31 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 25 Mar 2013 22:31:34 +0000 (23:31 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffserver.c

index 8acd59173b26153ecce25fe8b2337ae5c16de444..ac9627fced8b9f467e5e76b7a4d5b875f0be1793 100644 (file)
@@ -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;