diff options
author | J. Richard Barnette <jrbarnette@chromium.org> | 2013-10-30 11:36:45 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-31 21:56:58 +0000 |
commit | a3d70a3d2b5c052db039d097aaffa42008da24b5 (patch) | |
tree | 40263855d5eef64cea1c729e89397d0f4cef4880 /host/lib/crossystem.c | |
parent | fe2c1a231e3893dc3d7ac314e11b04a18c6948e7 (diff) | |
download | vboot-factory-panther-4920.23.B.tar.gz |
Make crossystem.h more polite and more useful.test-4980.Btest-4824.Bstabilize-R33-4982.Bstabilize-5062.Bstabilize-4920.6.Brelease-R32-4920.Bfirmware-bolt_kirby-4979.Bfactory-panther-4920.23.B
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.c | 6 |
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 */ |