Fix a use-after-return stack memory bug.

Use std::string to copy the returned value instead
of returning an invalid pointer to the stack.

Signed-off-by: Samuel Kogler <samuel.kogler@gmail.com>
Fix void pointer arithmetic (undefined behaviour).

Signed-off-by: Samuel Kogler <samuel.kogler@gmail.com>
Fix out of bounds write of array on stack.

Signed-off-by: Samuel Kogler <samuel.kogler@gmail.com>
Fix invalid iterator usage after deletion.

Signed-off-by: Samuel Kogler <samuel.kogler@gmail.com>
Merge pull request #5 from skogler/master

Fix some bugs found by static code analysis.