diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2015-10-22 21:38:01 +0200 |
---|---|---|
committer | Dees Troy <dees_troy@teamw.in> | 2015-10-25 00:38:44 +0200 |
commit | 7dad625926f1249386d4630b57f8e7f1a5059195 (patch) | |
tree | 39c62e5a80d784439c5b904f2cfcfc35968f2f11 | |
parent | Fix a bunch of warnings (diff) | |
download | android_bootable_recovery-7dad625926f1249386d4630b57f8e7f1a5059195.tar android_bootable_recovery-7dad625926f1249386d4630b57f8e7f1a5059195.tar.gz android_bootable_recovery-7dad625926f1249386d4630b57f8e7f1a5059195.tar.bz2 android_bootable_recovery-7dad625926f1249386d4630b57f8e7f1a5059195.tar.lz android_bootable_recovery-7dad625926f1249386d4630b57f8e7f1a5059195.tar.xz android_bootable_recovery-7dad625926f1249386d4630b57f8e7f1a5059195.tar.zst android_bootable_recovery-7dad625926f1249386d4630b57f8e7f1a5059195.zip |
-rw-r--r-- | data.cpp | 4 | ||||
-rw-r--r-- | infomanager.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -274,16 +274,18 @@ int DataManager::LoadValues(const string filename) string Name; string Value; unsigned short length; - char array[512]; + char array[513]; if (fread(&length, 1, sizeof(unsigned short), in) != sizeof(unsigned short)) goto error; if (length >= 512) goto error; if (fread(array, 1, length, in) != length) goto error; + array[length+1] = '\0'; Name = array; if (fread(&length, 1, sizeof(unsigned short), in) != sizeof(unsigned short)) goto error; if (length >= 512) goto error; if (fread(array, 1, length, in) != length) goto error; + array[length+1] = '\0'; Value = array; map<string, TStrIntPair>::iterator pos; diff --git a/infomanager.cpp b/infomanager.cpp index 864c431a5..2a4c3c892 100644 --- a/infomanager.cpp +++ b/infomanager.cpp @@ -67,16 +67,18 @@ int InfoManager::LoadValues(void) { string Name; string Value; unsigned short length; - char array[512]; + char array[513]; if (fread(&length, 1, sizeof(unsigned short), in) != sizeof(unsigned short)) goto error; if (length >= 512) goto error; if (fread(array, 1, length, in) != length) goto error; + array[length+1] = '\0'; Name = array; if (fread(&length, 1, sizeof(unsigned short), in) != sizeof(unsigned short)) goto error; if (length >= 512) goto error; if (fread(array, 1, length, in) != length) goto error; + array[length+1] = '\0'; Value = array; map<string, string>::iterator pos; |