Fix PROP_FILENAME_MAX overflow handling
Bug: b/79117743
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Change-Id: Idd5aa4d195abc13c06d3e5b57aef69a68c2a9a9d
diff --git a/libc/system_properties/system_properties.cpp b/libc/system_properties/system_properties.cpp
index 7c48b8e..d5c3647 100644
--- a/libc/system_properties/system_properties.cpp
+++ b/libc/system_properties/system_properties.cpp
@@ -67,7 +67,7 @@
return true;
}
- if (strlen(filename) > PROP_FILENAME_MAX) {
+ if (strlen(filename) >= PROP_FILENAME_MAX) {
return false;
}
strcpy(property_filename_, filename);
@@ -95,7 +95,7 @@
}
bool SystemProperties::AreaInit(const char* filename, bool* fsetxattr_failed) {
- if (strlen(filename) > PROP_FILENAME_MAX) {
+ if (strlen(filename) >= PROP_FILENAME_MAX) {
return false;
}
strcpy(property_filename_, filename);