Mitigate Baron SameEdit (CVE-2021-3156) vulnerability

centos 7
format weakness #18


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.

         snprintf(tw, sizeof(tw), "%3u", a->worst_value);
        tw[sizeof(tw)-1] = 0;
        snprintf(tc, sizeof(tc), "%3u", a->current_value);
        tc[sizeof(tc)-1] = 0;

        highlight = a->warn && isatty(1);

        if (highlight)
                fprintf(stderr, HIGHLIGHT);

        printf("%3u %-27s %-3s   %-3s   %-3s   %-11s 0x%02x%02x%02x%02x%02x%02x %-7s %-7s %-4s %-4s\n",
               print_name(name, sizeof(name), a->id, a->name),
               a->current_value_valid ? tc : "n/a",
               a->worst_value_valid ? tw : "n/a",
               a->threshold_valid ? tt : "n/a",
               print_value(pretty, sizeof(pretty), a->pretty_value, a->pretty_unit),
               a->raw[0], a->raw[1], a->raw[2], a->raw[3], a->raw[4], a->raw[5],
               a->prefailure ? "prefail" : "old-age",
               a->online ? "online" : "offline",
               a->good_now_valid ? yes_no(a->good_now) : "n/a",
               a->good_in_the_past_valid ? yes_no(a->good_in_the_past) : "n/a");

        if (highlight)
                fprintf(stderr, ENDHIGHLIGHT);

int sk_disk_dump(SkDisk *d) {
        int ret;
        SkBool awake = FALSE;
        uint64_t size;


        printf("Device: %s%s%s\n"
               "Type: %s\n",
               d->name ? disk_type_to_prefix_string(d->type) : "",
               d->name ? ":" : "",
               d->name ? d->name : "n/a",

        ret = sk_disk_get_size(d, &size);
        if (ret >= 0)
                printf("Size: %lu MiB\n", (unsigned long) (d->size/1024/1024));
                printf("Size: %s\n", strerror(errno));

        if (d->identify_valid) {
                const SkIdentifyParsedData *ipd;
                SkSmartQuirk quirk = 0; 

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.