summaryrefslogtreecommitdiffstats
path: root/fastboot/engine.c
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2010-07-29 11:08:02 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-29 11:08:02 -0700
commit42b871f1bfc116d53d1bff9d7497415494b2e0e0 (patch)
tree68a2de5b4b9271a9c15f5c46d58cdb0020dad542 /fastboot/engine.c
parent331eb52d611de6bd2e70a2b0bde1f3c3733ce657 (diff)
parentc37ba1c916d73fbf35c6faba1e252e2916d2d41d (diff)
downloadcore-42b871f1bfc116d53d1bff9d7497415494b2e0e0.tar.gz
core-42b871f1bfc116d53d1bff9d7497415494b2e0e0.tar.bz2
core-42b871f1bfc116d53d1bff9d7497415494b2e0e0.zip
am c37ba1c9: Merge "Check fastboot oem command line length"
Merge commit 'c37ba1c916d73fbf35c6faba1e252e2916d2d41d' into gingerbread-plus-aosp * commit 'c37ba1c916d73fbf35c6faba1e252e2916d2d41d': Check fastboot oem command line length
Diffstat (limited to 'fastboot/engine.c')
-rw-r--r--fastboot/engine.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fastboot/engine.c b/fastboot/engine.c
index 8ba202cd1..48073ee37 100644
--- a/fastboot/engine.c
+++ b/fastboot/engine.c
@@ -97,14 +97,20 @@ static Action *queue_action(unsigned op, const char *fmt, ...)
{
Action *a;
va_list ap;
+ size_t cmdsize;
a = calloc(1, sizeof(Action));
if (a == 0) die("out of memory");
va_start(ap, fmt);
- vsprintf(a->cmd, fmt, ap);
+ cmdsize = vsnprintf(a->cmd, sizeof(a->cmd), fmt, ap);
va_end(ap);
+ if (cmdsize >= sizeof(a->cmd)) {
+ free(a);
+ die("Command length (%d) exceeds maximum size (%d)", cmdsize, sizeof(a->cmd));
+ }
+
if (action_last) {
action_last->next = a;
} else {