Mitigate Baron SameEdit (CVE-2021-3156) vulnerability

centos 7
format weakness #13


Weakness Breakdown


A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:



The highlighted line of code below is the trigger point of this particular Centos 7 format weakness.

#include "canberra.h"
#include "macro.h"

#ifndef PACKAGE
#error "Please include config.h before including this file!"

#define ca_malloc malloc
#define ca_free free
#define ca_malloc0(size) calloc(1, (size))
#define ca_strdup strdup
#define ca_strndup strndup
char *ca_strndup(const char *s, size_t n);

void* ca_memdup(const void* p, size_t size);

#define ca_new(t, n) ((t*) ca_malloc(sizeof(t)*(n)))
#define ca_new0(t, n) ((t*) ca_malloc0(sizeof(t)*(n)))
#define ca_newdup(t, p, n) ((t*) ca_memdup(p, sizeof(t)*(n)))

char *ca_sprintf_malloc(const char *format, ...) __attribute__((format(printf, 1, 2)));


The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.