summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2013-04-24 17:37:37 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-24 17:37:37 -0700
commit49edc0acf8c78171751676af0f530d9529987075 (patch)
tree24cb6de81c44dfea68322362b0c174104fc21a30
parentaf1cbd4c10cfc28235d7a60941290986a77affda (diff)
parent4c1840e6547266ba251d8c34905036d73240ff57 (diff)
downloadsystem_core-49edc0acf8c78171751676af0f530d9529987075.zip
system_core-49edc0acf8c78171751676af0f530d9529987075.tar.gz
system_core-49edc0acf8c78171751676af0f530d9529987075.tar.bz2
am 4c1840e6: am 5ea58543: Merge "mount: fix incorrect string length calculation"
* commit '4c1840e6547266ba251d8c34905036d73240ff57': mount: fix incorrect string length calculation
-rw-r--r--toolbox/mount.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/toolbox/mount.c b/toolbox/mount.c
index b7adce2..bcda2a2 100644
--- a/toolbox/mount.c
+++ b/toolbox/mount.c
@@ -19,7 +19,7 @@
#define LOOPDEV_MAXLEN 64
struct mount_opts {
- const char str[8];
+ const char str[16];
unsigned long rwmask;
unsigned long rwset;
unsigned long rwnoset;
@@ -65,10 +65,11 @@ static const struct mount_opts options[] = {
static void add_extra_option(struct extra_opts *extra, char *s)
{
int len = strlen(s);
- int newlen = extra->used_size + len;
+ int newlen;
if (extra->str)
len++; /* +1 for ',' */
+ newlen = extra->used_size + len;
if (newlen >= extra->alloc_size) {
char *new;
@@ -79,7 +80,7 @@ static void add_extra_option(struct extra_opts *extra, char *s)
extra->str = new;
extra->end = extra->str + extra->used_size;
- extra->alloc_size = newlen;
+ extra->alloc_size = newlen + 1;
}
if (extra->used_size) {