Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Issue 1196001: Don't treat the error message as a format string in die(). (Closed)

Created:
10 years, 9 months ago by robotboy
Modified:
9 years, 7 months ago
Reviewers:
mbligh, ericli, sosa
CC:
chromium-os-reviews_chromium.org, kmixter1, petkov, seano, sosa, ericli
Visibility:
Public.

Description

Don't treat the error message as a format string in die(). This could become a bug if the error message contained formatting characters that would cause fprintf to try and read varargs that aren't there.

Patch Set 1 #

Total comments: 2

Patch Set 2 : Combine two fprintf calls into one. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -2 lines) Patch
M client/tests/disktest/src/disktest.c View 1 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
robotboy
10 years, 9 months ago (2010-03-23 19:50:35 UTC) #1
sosa
nit o/w lgtm http://codereview.chromium.org/1196001/diff/1/2 File client/tests/disktest/src/disktest.c (right): http://codereview.chromium.org/1196001/diff/1/2#newcode46 client/tests/disktest/src/disktest.c:46: fprintf(stderr, "%s", error); Combine with \n ...
10 years, 9 months ago (2010-03-23 19:54:22 UTC) #2
ericli
Upstream this change please. On 2010/03/23 19:54:22, sosa wrote: > nit o/w lgtm > > ...
10 years, 9 months ago (2010-03-23 19:56:07 UTC) #3
robotboy
fprintf's combined. And yup, will upstream. Thanks all. http://codereview.chromium.org/1196001/diff/1/2 File client/tests/disktest/src/disktest.c (right): http://codereview.chromium.org/1196001/diff/1/2#newcode46 client/tests/disktest/src/disktest.c:46: fprintf(stderr, ...
10 years, 9 months ago (2010-03-23 20:22:38 UTC) #4
mbligh_google.com
10 years, 9 months ago (2010-03-23 21:20:25 UTC) #5
oops.

LGTM

On Tue, Mar 23, 2010 at 12:50 PM,  <robotboy@chromium.org> wrote:
> Reviewers: mbligh, sosa,
>
> Description:
> Don't treat the error message as a format string in die().
>
> This could become a bug if the error message contained formatting
> characters that would cause fprintf to try and read varargs that
> aren't there.
>
> Please review this at http://codereview.chromium.org/1196001
>
> Affected files:
>  M client/tests/disktest/src/disktest.c
>
>
> Index: client/tests/disktest/src/disktest.c
> diff --git a/client/tests/disktest/src/disktest.c
> b/client/tests/disktest/src/disktest.c
> index
>
b07feb25f49a90515abc989449d3a7df66f48d9a..7b67476621b8e1b1020ccfe5dd8bf4158d40ffbd
> 100644
> --- a/client/tests/disktest/src/disktest.c
> +++ b/client/tests/disktest/src/disktest.c
> @@ -43,7 +43,7 @@ unsigned int stop_on_error = 0;
>
>  void die(char *error)
>  {
> -       fprintf(stderr, error);
> +       fprintf(stderr, "%s", error);
>        fprintf(stderr, "\n");
>        exit(1);
>  }
>
>
>

Powered by Google App Engine
This is Rietveld 408576698