summaryrefslogtreecommitdiff
path: root/utility/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 /utility/crossystem.c
parentfe2c1a231e3893dc3d7ac314e11b04a18c6948e7 (diff)
downloadvboot-a3d70a3d2b5c052db039d097aaffa42008da24b5.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 'utility/crossystem.c')
-rw-r--r--utility/crossystem.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/utility/crossystem.c b/utility/crossystem.c
index d7007eeb..520f7fdf 100644
--- a/utility/crossystem.c
+++ b/utility/crossystem.c
@@ -11,9 +11,6 @@
#include "crossystem.h"
-/* Max length of a string parameter */
-#define MAX_STRING 8192
-
/*
* Call arch specific init, if provided, otherwise use the 'weak' stub.
*/
@@ -153,7 +150,7 @@ int SetParam(const Param* p, const char* value) {
* Returns 0 if success (match), non-zero if error (mismatch). */
int CheckParam(const Param* p, char* expect) {
if (p->flags & IS_STRING) {
- char buf[MAX_STRING];
+ char buf[VB_MAX_STRING_PROPERTY];
const char* v = VbGetSystemPropertyString(p->name, buf, sizeof(buf));
if (!v || 0 != strcmp(v, expect))
return 1;
@@ -175,7 +172,7 @@ int CheckParam(const Param* p, char* expect) {
* Returns 0 if success, non-zero if error. */
int PrintParam(const Param* p) {
if (p->flags & IS_STRING) {
- char buf[MAX_STRING];
+ char buf[VB_MAX_STRING_PROPERTY];
const char* v = VbGetSystemPropertyString(p->name, buf, sizeof(buf));
if (!v)
return 1;
@@ -197,7 +194,7 @@ int PrintParam(const Param* p) {
int PrintAllParams(int force_all) {
const Param* p;
int retval = 0;
- char buf[MAX_STRING];
+ char buf[VB_MAX_STRING_PROPERTY];
const char* value;
for (p = sys_param_list; p->name; p++) {