From bb1c35235b71079b20f469421a895b038bcfa0db Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 5 Dec 2018 08:23:06 +0100 Subject: XDR: Add proper get_string method --- src/os/object/xdrinput.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/os/object/xdrinput.cc b/src/os/object/xdrinput.cc index 077f695..5fb17bf 100644 --- a/src/os/object/xdrinput.cc +++ b/src/os/object/xdrinput.cc @@ -61,3 +61,17 @@ char *XDRInput::get_opaque(uint32_t length) } return ret; } + +void XDRInput::get_string(char* target) +{ + uint16_t length = get_opaque_length(); + uint16_t i; + for (i = 0; i < length; i++) { + target[i] = data[pos + i]; + } + target[i] = 0; + pos += length; + if (length % 4) { + pos += 4 - (length % 4); + } +} -- cgit v1.2.3