Fix QByteArray memory corruption in QIBaseDriver::open().

Rewrite code to use QByteArray::reserve(), QByteArray::append()
instead of memcpy().

Task-number: QTBUG-37508
Change-Id: I16ead153f33fa5a34bc01ee27ae4cd1b8993b65e
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
(cherry picked from qtbase/0d50efeae9829336ffb7e47692cfdc649e10ee70)