Buffer with garbage could cause problems
Issue #27
resolved
If the toolkit is given a non empty buffer the output will include content of this buffer.
This can be fixed by not taking the output length with strlen and just going with our counter. FIX and test
Note: My silly test overflows the buffer when the fix isn't applied. Maybe there should be a check for that overflow?
$ ./test0100_outjson_garbage_buffer32
input(97):
{"pgm":[{"name":"HELLO","lib":"DB2JSON"},{"s":{"name":"char","type":"128a","value":"Hi there"}}]}
output(587):
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXÞ"script":[{"pgm":["HELLO","DB2JSON",{"char":"Hello World"}]}]}
result:
fail found(X)
fail (-1)
Segmentation fault (core dumped)
Comments (4)
-
Account Deleted -
reporter It was there originally because the buffer length wasn't stored and the length was calculated every time. But now it is completely useless as we get the length from outside.
-
Account Deleted Ok. Are we done with this issue?
-
reporter - changed status to resolved
All OK, thank you.
- Log in to comment
Ok, i removed strlen from json_output_printf.
YIPS Super Driver - test driver - 1.1.4-sg7 toolkit - Buffer with garbage could cause problems (Halmela)
Mm ... json_output_printf seems to work with tests. I have no idea why originally added. I commented out in source for now.
Thanks (i think).