X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cmd%2Fmtdparts.c;h=c4010091338fe30e9531917b9622fa2686214123;hb=040b2583c3a87c83606b3df64ea653ccaf3aea62;hp=72bff92a9aee591060233b5169509ea06b05dffc;hpb=54f1792c8df1dba9cd41d811a7860ddd417f634e;p=u-boot diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index 72bff92a9a..c401009133 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2002 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. @@ -20,8 +21,6 @@ * * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * Copyright 2002 SYSGO Real-Time Solutions GmbH - * - * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -81,7 +80,7 @@ #include #if defined(CONFIG_CMD_NAND) -#include +#include #include #endif @@ -873,15 +872,12 @@ static int device_parse(const char *const mtd_dev, const char **ret, struct mtd_ return 1; } -#ifdef DEBUG pend = strchr(p, ';'); -#endif debug("dev type = %d (%s), dev num = %d, mtd-id = %s\n", id->type, MTD_DEV_TYPE(id->type), id->num, id->mtd_id); debug("parsing partitions %.*s\n", (int)(pend ? pend - p : strlen(p)), p); - /* parse partitions */ num_parts = 0; @@ -1726,7 +1722,7 @@ int mtdparts_init(void) const char *ids, *parts; const char *current_partition; int ids_changed; - char tmp_ep[PARTITION_MAXLEN]; + char tmp_ep[PARTITION_MAXLEN + 1]; char tmp_parts[MTDPARTS_MAXLEN]; debug("\n---mtdparts_init---\n"); @@ -1750,7 +1746,8 @@ int mtdparts_init(void) /* save it for later parsing, cannot rely on current partition pointer * as 'partition' variable may be updated during init */ - tmp_ep[0] = '\0'; + memset(tmp_parts, 0, sizeof(tmp_parts)); + memset(tmp_ep, 0, sizeof(tmp_ep)); if (current_partition) strncpy(tmp_ep, current_partition, PARTITION_MAXLEN);