Project

General

Profile

Actions

Bug #9564

closed

cw: possible buffer overflow in cw

Added by Toomas Soome about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
tools - gate/build tools
Start date:
2018-05-30
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

While building with gcc 8:

    cw.c: In function 'prepctx':
    cw.c:1325:33: error: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 2 [-Werror=format-truncation=]
          (void) snprintf(s, len, "-O%d", level);
                                     ^~
    cw.c:1325:30: note: directive argument in the range [-2147483648, 5]
          (void) snprintf(s, len, "-O%d", level);
                                  ^~~~~~
    cw.c:1325:13: note: 'snprintf' output between 4 and 14 bytes into a destination of size 4
          (void) snprintf(s, len, "-O%d", level);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

Use asprintf instead.

Actions #1

Updated by Electric Monk about 4 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 538ff3037bec24f93f1358dd680f4bb077c9c0a2

commit  538ff3037bec24f93f1358dd680f4bb077c9c0a2
Author: Toomas Soome <tsoome@me.com>
Date:   2018-06-19T17:03:35.000Z

    9564 cw: possible buffer overflow in cw
    Reviewed by: Yuri Pankov <yuripv@yuripv.net>
    Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
    Approved by: Robert Mustacchi <rm@joyent.com>

Actions

Also available in: Atom PDF