Skip to content

Commit 8ca71e4

Browse files
committed
JSON output: fix segmentation fault of "print" output
SEFAULT is caused by broken std::cout due to RTLD_DEEPBIND flag used during loading of the plugin.The issue requires further investigation.
1 parent c9c2ed1 commit 8ca71e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/plugins/output/json/src/Printer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ Printer::Printer(const struct cfg_print &cfg, ipx_ctx_t *ctx) : Output(cfg.name,
5050
int
5151
Printer::process(const char *str, size_t len)
5252
{
53-
(void) len;
54-
std::cout << str;
53+
// The string is not NULL terminated
54+
const std::string temp = {str, len};
55+
printf("%s", temp.c_str());
5556
return IPX_OK;
5657
}

0 commit comments

Comments
 (0)