mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
ffserver/ctime1: avoid using strcpy()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
ea4c99de4c
commit
4a595cff79
@ -396,14 +396,14 @@ static int resolve_host(struct in_addr *sin_addr, const char *hostname)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *ctime1(char *buf2)
|
static char *ctime1(char *buf2, int buf_size)
|
||||||
{
|
{
|
||||||
time_t ti;
|
time_t ti;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
ti = time(NULL);
|
ti = time(NULL);
|
||||||
p = ctime(&ti);
|
p = ctime(&ti);
|
||||||
strcpy(buf2, p);
|
av_strlcpy(buf2, p, buf_size);
|
||||||
p = buf2 + strlen(p) - 1;
|
p = buf2 + strlen(p) - 1;
|
||||||
if (*p == '\n')
|
if (*p == '\n')
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
@ -416,7 +416,7 @@ static void http_vlog(const char *fmt, va_list vargs)
|
|||||||
if (logfile) {
|
if (logfile) {
|
||||||
if (print_prefix) {
|
if (print_prefix) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
ctime1(buf);
|
ctime1(buf, sizeof(buf));
|
||||||
fprintf(logfile, "%s ", buf);
|
fprintf(logfile, "%s ", buf);
|
||||||
}
|
}
|
||||||
print_prefix = strstr(fmt, "\n") != NULL;
|
print_prefix = strstr(fmt, "\n") != NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user