[njs] Fixed passing uninitialized value to printf().

Dmitry Volyntsev xeioex at nginx.com
Fri Sep 1 15:51:43 UTC 2017


details:   http://hg.nginx.org/njs/rev/fc92d8af502c
branches:  
changeset: 406:fc92d8af502c
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Sep 01 18:51:17 2017 +0300
description:
Fixed passing uninitialized value to printf().

Previously, njs_ext_console_log() passed an uninitialized value to
printf() function in the case of an error. The precison argument was set
to 0 in such a case, so well-behaved implementation was able to handle
it properly.

Setting this value to NULL, just to make sure and to make Coverity Scan
happy.

diffstat:

 njs/njs.c |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 2a8aa9783fe9 -r fc92d8af502c njs/njs.c
--- a/njs/njs.c	Thu Aug 31 20:50:25 2017 +0300
+++ b/njs/njs.c	Fri Sep 01 18:51:17 2017 +0300
@@ -598,6 +598,7 @@ njs_ext_console_log(njs_vm_t *vm, njs_va
     nxt_str_t  msg;
 
     msg.length = 0;
+    msg.start = NULL;
 
     if (nargs >= 2
         && njs_value_to_ext_string(vm, &msg, njs_argument(args, 1))


More information about the nginx-devel mailing list