Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omicli -xml crashes when response includes certain characters #196

Closed
gorankor opened this issue Jan 18, 2017 · 0 comments
Closed

omicli -xml crashes when response includes certain characters #196

gorankor opened this issue Jan 18, 2017 · 0 comments

Comments

@gorankor
Copy link

omicli always crashes on this request for me:

$ omicli -t -xml -u ... -p ... --hostname ... gi root/cimv2 '{' Win32_Service name spooler '}'

The crash happens here when accessing the "_encode" array outside of its bounds:

Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000000000040fd3b in WriteBuffer_Char (clientBuffer=0x1df59f0 "<INSTANCE CLASSNAME="Win32_Service"><PROPERTY NAME="AcceptPause" TYPE="string">false<PROPERTY NAME="AcceptStop" TYPE="string">true<PROPERTY NAME="Ca"..., clientBufferLength=10000, clientBufferNeeded=0x7ffccb193ecc, charToWrite=-30 '\342', escapingDepth=1, result=0x7ffccb193e18) at xmlserializer.c:894
894 (_encode[(unsigned int)charToWrite].str == NULL))

Here's the interesting part of the received string - the problematic character being E2:

$ tail -1 omiclient-recv.trc | xxd
...
0000490: 7365 7276 6963 652c 2079 6f75 2077 6f6e service, you won
00004a0: e280 9974 2062 6520 6162 6c65 2074 6f20 ...t be able to
00004b0: 7072 696e 7420 6f72 2073 6565 2079 6f75 print or see you
00004c0: 7220 7072 696e 7465 7273 2e3c 2f70 3a44 r printers.</p:D
...

The fix is simple - just ensure array index is OK before accessing it.

paulcallen pushed a commit that referenced this issue Jan 21, 2017
xml.c was a hang, xmlserializer.c was a crash.
Fixes issue #196
paulcallen pushed a commit that referenced this issue Jan 21, 2017
xml.c was a hang, xmlserializer.c was a crash.
Fixes issue #196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants