Skip to content

Commit

Permalink
lavc_common: get_avpixfmts_names: Clear buf first
Browse files Browse the repository at this point in the history
Since the buffer is static, it contains stuff from previous run of the
function. We need to clear it before appending new pixfmts in the loop.
  • Loading branch information
mpiatka committed Nov 7, 2023
1 parent 0b4c0e8 commit 0102346
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/libavcodec/lavc_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ get_avpixfmts_names(const enum AVPixelFormat *pixfmts)
snprintf(buf, sizeof buf, "(none)");
return buf;
}
buf[0] = '\0';
const enum AVPixelFormat *it = pixfmts;
while (*it != AV_PIX_FMT_NONE) {
snprintf(buf + strlen(buf), sizeof buf - strlen(buf), "%s%s",
Expand Down

0 comments on commit 0102346

Please sign in to comment.