[codec,fdk] fix use of strcat

This commit is contained in:
akallabeth 2024-09-19 13:16:18 +02:00
parent 3825fe8135
commit 1947f28a70

View File

@ -210,16 +210,24 @@ static void log_enc_info(const AACENC_InfoStruct* info, fdk_log_fkt_t log)
assert(info); assert(info);
assert(log); assert(log);
strcat(confBuf, "{"); size_t offset = 0;
size_t remain = sizeof(confBuf) - 1;
int rc = snprintf(confBuf, remain, "{");
if (rc <= 0)
return;
offset += (size_t)rc;
for (size_t x = 0; x < 64; x++) for (size_t x = 0; x < 64; x++)
{ {
char tmp[12] = { 0 }; rc = snprintf(&confBuf[offset], remain - offset, "0x%02x%s", (int)info->confBuf[x],
sprintf(tmp, "0x%02x", (int)info->confBuf[x]); (x > 0) ? ", " : "");
if (x > 0) if (rc <= 0)
strcat(confBuf, ", "); return;
strcat(confBuf, tmp);
} }
strcat(confBuf, "}");
rc = snprintf(confBuf, remain - offset, "}");
if (rc <= 0)
return;
log(WLOG_DEBUG, log(WLOG_DEBUG,
"[encoder info] " "[encoder info] "