summaryrefslogtreecommitdiff
path: root/host/lib/crossystem.c
diff options
context:
space:
mode:
authorJ. Richard Barnette <jrbarnette@chromium.org>2013-10-30 11:36:45 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-31 21:56:58 +0000
commita3d70a3d2b5c052db039d097aaffa42008da24b5 (patch)
tree40263855d5eef64cea1c729e89397d0f4cef4880 /host/lib/crossystem.c
parentfe2c1a231e3893dc3d7ac314e11b04a18c6948e7 (diff)
downloadvboot-factory-panther-4920.23.B.tar.gz
This adds a VB_MAX_STRING_PROPERTY for callers that don't want to guess at how big to make their buffers. Additionally, it changes the size parameter to VbGetPropertyString() from int to size_t. BUG=None TEST=compile the code BRANCH=none Change-Id: I22809d48e13b535593cb22a56444e2dcb27791a5 Reviewed-on: https://chromium-review.googlesource.com/175039 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
Diffstat (limited to 'host/lib/crossystem.c')
-rw-r--r--host/lib/crossystem.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index b4824332..b4962591 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -69,7 +70,7 @@ typedef enum VbBuildOption {
/* Return true if the FWID starts with the specified string. */
int FwidStartsWith(const char *start) {
- char fwid[128];
+ char fwid[VB_MAX_STRING_PROPERTY];
if (!VbGetSystemPropertyString("fwid", fwid, sizeof(fwid)))
return 0;
@@ -492,7 +493,8 @@ int VbGetSystemPropertyInt(const char* name) {
}
-const char* VbGetSystemPropertyString(const char* name, char* dest, int size) {
+const char* VbGetSystemPropertyString(const char* name, char* dest,
+ size_t size) {
static const char unknown_string[] = "unknown";
/* Check architecture-dependent properties first */