Fix various memory errors

There were a few memory errors while restoring a backup via adb (created
using `adb backup --twrp`).
On my device (S5 mini) it resulted in this error message:

  FORTIFY: strlen: prevented read past end of buffer

This commit fixes this issue and a few other potential issues.

Change-Id: I5022c94c961217238b3fefec0b2c4b8c6fa26ec7
diff --git a/adbbu/twadbstream.h b/adbbu/twadbstream.h
index 23d4a1f..5fa6bde 100644
--- a/adbbu/twadbstream.h
+++ b/adbbu/twadbstream.h
@@ -65,6 +65,11 @@
 	char type[16];					//stores the type of command, TWENDADB, TWCNT, TWEOF, TWMD5, TWDATA and TWERROR
 	uint32_t crc;					//stores the zlib 32 bit crc of the AdbBackupControlType struct to allow for making sure we are processing metadata
 	char space[484];				//stores space to align the struct to 512 bytes
+
+	//return a C++ string while not reading outside the type char array
+	std::string get_type() {
+		return std::string(type, strnlen(type, sizeof(type)-1));
+	}
 };
 
 //general info for file metadata stored in adb backup header