aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+github@glassechidna.com.au>2016-02-08 18:15:52 +1100
committerBenjamin Dobell <benjamin.dobell+github@glassechidna.com.au>2016-02-08 18:15:52 +1100
commit8e45fd81c97a40207035daf1c06019fcf40f8fba (patch)
treed2a2a0b67d23e278d350a0d4b228d249033b7750
parentd0526a3b74a003dfc6f805682693be9173ffcd88 (diff)
parent4be0c303025d8f012d82f79b3dccb330d3fb47ed (diff)
downloadexternal_heimdall-8e45fd81c97a40207035daf1c06019fcf40f8fba.zip
external_heimdall-8e45fd81c97a40207035daf1c06019fcf40f8fba.tar.gz
external_heimdall-8e45fd81c97a40207035daf1c06019fcf40f8fba.tar.bz2
Merge pull request #325 from vaselo/master
Fixed libpit array overflows
-rw-r--r--libpit/source/libpit.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/libpit/source/libpit.h b/libpit/source/libpit.h
index ccdea20..dbf731a 100644
--- a/libpit/source/libpit.h
+++ b/libpit/source/libpit.h
@@ -208,12 +208,12 @@ namespace libpit
void SetPartitionName(const char *partitionName)
{
// This isn't strictly necessary but ensures no junk is left in our PIT file.
- memset(this->partitionName, 0, 64);
+ memset(this->partitionName, 0, kPartitionNameMaxLength);
- if (strlen(partitionName) < 64)
+ if (strlen(partitionName) < kPartitionNameMaxLength)
strcpy(this->partitionName, partitionName);
else
- memcpy(this->partitionName, partitionName, 63);
+ memcpy(this->partitionName, partitionName, kPartitionNameMaxLength - 1);
}
const char *GetFlashFilename(void) const
@@ -226,10 +226,10 @@ namespace libpit
// This isn't strictly necessary but ensures no junk is left in our PIT file.
memset(this->flashFilename, 0, kFlashFilenameMaxLength);
- if (strlen(partitionName) < 32)
+ if (strlen(partitionName) < kFlashFilenameMaxLength)
strcpy(this->flashFilename, flashFilename);
else
- memcpy(this->flashFilename, flashFilename, 31);
+ memcpy(this->flashFilename, flashFilename, kFlashFilenameMaxLength - 1);
}
const char *GetFotaFilename(void) const
@@ -242,10 +242,10 @@ namespace libpit
// This isn't strictly necessary but ensures no junk is left in our PIT file.
memset(this->fotaFilename, 0, kFotaFilenameMaxLength);
- if (strlen(partitionName) < 32)
+ if (strlen(partitionName) < kFotaFilenameMaxLength)
strcpy(this->fotaFilename, fotaFilename);
else
- memcpy(this->fotaFilename, fotaFilename, 31);
+ memcpy(this->fotaFilename, fotaFilename, kFotaFilenameMaxLength - 1);
}
};