Skip to content

Commit 2f96369

Browse files
committed
Avoid using strncpy
1 parent e15007e commit 2f96369

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

av/filter/loudnorm_impl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ static void logging_callback(void *ptr, int level, const char *fmt, va_list vl)
3636
pthread_mutex_lock(&json_mutex);
3737
#endif
3838

39-
strncpy(json_buffer, json_start, sizeof(json_buffer) - 1);
39+
size_t len = strnlen(json_start, sizeof(json_buffer) - 1);
40+
memcpy(json_buffer, json_start, len);
41+
json_buffer[len] = '\0';
4042
json_captured = 1;
4143

4244
#ifdef _WIN32

0 commit comments

Comments
 (0)