]> git.kaiwu.me - njs.git/commitdiff
Fixed passing uninitialized value to printf().
authorDmitry Volyntsev <xeioex@nginx.com>
Fri, 1 Sep 2017 15:51:17 +0000 (18:51 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Fri, 1 Sep 2017 15:51:17 +0000 (18:51 +0300)
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.

njs/njs.c

index f1a404a58c3effafb905e379171c92e600d29c16..d82c994cc709464fd602636f496bd495d4ce3147 100644 (file)
--- a/njs/njs.c
+++ b/njs/njs.c
@@ -598,6 +598,7 @@ njs_ext_console_log(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     nxt_str_t  msg;
 
     msg.length = 0;
+    msg.start = NULL;
 
     if (nargs >= 2
         && njs_value_to_ext_string(vm, &msg, njs_argument(args, 1))