diff options
author | Andreas Gampe <agampe@google.com> | 2017-09-26 20:41:48 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2017-10-31 14:51:58 -0700 |
commit | 7e01b2b17947ddeb5a26004ac6870c12caf52257 (patch) | |
tree | f3344d4f5fdf19c84bddbe72fbf0ee7287c21f83 /cmds | |
parent | c1149c9797e42f10c82cdcc8d1e69861e0114c02 (diff) | |
download | native-7e01b2b17947ddeb5a26004ac6870c12caf52257.tar.gz |
Otapreopt: Fix property handling
Follow-up to commit 1b9d9a6006f4159e2cc2c41330f316b1fdc53fe1.
In the previous CL, a strncpy was translated incorrectly to a
strlcpy. Fix the glitch.
(cherry picked from commit 5696e6353b4f349b316097fcb783b4cfcb5511ef)
Bug: 36655947
Bug: 66996038
Test: manual A/B OTA
Merged-In: I387ff8436de351a3cec5458b3ef013e15905a046
Change-Id: I387ff8436de351a3cec5458b3ef013e15905a046
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/installd/otapreopt.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cmds/installd/otapreopt.cpp b/cmds/installd/otapreopt.cpp index a58ba4117b..e0d23da34c 100644 --- a/cmds/installd/otapreopt.cpp +++ b/cmds/installd/otapreopt.cpp @@ -150,10 +150,9 @@ class OTAPreoptService { value[kPropertyValueMax - 1] = 0; return strlen(default_value);// TODO: Need to truncate? } - size_t size = std::min(kPropertyValueMax - 1, prop_value->length()); + size_t size = std::min(kPropertyValueMax - 1, prop_value->length()) + 1; strlcpy(value, prop_value->data(), size); - value[size] = 0; - return static_cast<int>(size); + return static_cast<int>(size - 1); } std::string GetOTADataDirectory() const { |