Bug 1646206 - Fix a vsnprintf lint in ClearKeyUtils.cpp r=bryce

We have a clang-plugin check that discourages raw `vsnprintf`, but for some reason it doesn't catch this before clang 11. I _think_ it's related to earlier versions not being able to see that `len` is a constant, but I'm not really sure.

Differential Revision: https://phabricator.services.mozilla.com/D79918
This commit is contained in:
David Major 2020-06-16 23:06:22 +00:00
parent 67acf10354
commit dd955b19e7

View File

@ -36,6 +36,7 @@
#include "ArrayUtils.h"
#include "BigEndian.h"
#include "ClearKeyBase64.h"
#include "mozilla/Sprintf.h"
#include "pk11pub.h"
#include "prerror.h"
#include "psshparser/PsshParser.h"
@ -74,7 +75,7 @@ void CK_Log(const char* aFmt, ...) {
va_start(ap, aFmt);
const size_t len = 1024;
char buf[len];
vsnprintf(buf, len, aFmt, ap);
VsprintfLiteral(buf, aFmt, ap);
va_end(ap);
fprintf(out, "%s\n", buf);