summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-06-11 11:33:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-06-11 11:33:34 +0200
commit06b8bc4d708b8ff4eba1dd9b48ec110a8019d2c8 (patch)
tree3c7c238c81aa91405159959906f31f6195aa6217 /common
parentb697fba4a5c5395a9db271efa286870191418040 (diff)
parentb917f7864115a35fbb9e69af2c1d553a110a37fc (diff)
downloadbarebox-06b8bc4d708b8ff4eba1dd9b48ec110a8019d2c8.tar.gz
barebox-06b8bc4d708b8ff4eba1dd9b48ec110a8019d2c8.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig6
-rw-r--r--common/filetype.c2
-rw-r--r--common/hush.c7
-rw-r--r--common/state/backend_bucket_direct.c7
4 files changed, 13 insertions, 9 deletions
diff --git a/common/Kconfig b/common/Kconfig
index cac1113d45..f5777a304c 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1020,12 +1020,6 @@ config DEFAULT_LOGLEVEL
7 debug-level messages (debug)
8 verbose debug messages (vdebug)
-config DEBUG_INFO
- bool
- prompt "enable debug symbols"
- help
- Enable build of barebox with -g.
-
config DEBUG_LL
bool
depends on HAS_DEBUG_LL
diff --git a/common/filetype.c b/common/filetype.c
index e2d707b156..9675009eb0 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -37,7 +37,7 @@ struct filetype_str {
};
static const struct filetype_str filetype_str[] = {
- [filetype_unknown] = { "unknown", "unkown" },
+ [filetype_unknown] = { "unknown", "unknown" },
[filetype_arm_zimage] = { "ARM Linux zImage", "arm-zimage" },
[filetype_lzo_compressed] = { "LZO compressed", "lzo" },
[filetype_lz4_compressed] = { "LZ4 compressed", "lz4" },
diff --git a/common/hush.c b/common/hush.c
index dab9b04081..68c3eccdfc 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -402,7 +402,12 @@ static void b_free(o_string *o)
static int b_adduint(o_string *o, unsigned int i)
{
int r;
- char *p = simple_itoa(i);
+ /* 21 digits plus null terminator, good for 64-bit or smaller
+ * ints */
+ char number[22];
+ char *p = number;
+
+ snprintf(number, sizeof(number), "%u", i);
/* no escape checking necessary */
do {
diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index 95ddb93106..0dbd334db8 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -52,7 +52,7 @@ static int state_backend_bucket_direct_read(struct state_backend_storage_bucket
struct state_backend_storage_bucket_direct *direct =
get_bucket_direct(bucket);
struct state_backend_storage_bucket_direct_meta meta;
- ssize_t read_len;
+ uint32_t read_len;
void *buf;
int ret;
@@ -67,6 +67,11 @@ static int state_backend_bucket_direct_read(struct state_backend_storage_bucket
}
if (meta.magic == direct_magic) {
read_len = meta.written_length;
+ if (read_len > direct->max_size) {
+ dev_err(direct->dev, "Wrong length in meta data\n");
+ return -EINVAL;
+
+ }
} else {
if (meta.magic != ~0 && !!meta.magic)
bucket->wrong_magic = 1;