diff options
author | Yuichiro Goto <goto@k-tech.co.jp> | 2021-04-26 08:08:03 +0900 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-04-27 08:05:30 -0400 |
commit | 77ed7a2ac975e4b72a1bd87e5c475c08c23bb06a (patch) | |
tree | 08192122d198d09e0ec0e5b43f475609afc2d507 /common | |
parent | 230bc623a49a214bdf1a53971404ab762414ec71 (diff) | |
download | u-boot-77ed7a2ac975e4b72a1bd87e5c475c08c23bb06a.tar.gz u-boot-77ed7a2ac975e4b72a1bd87e5c475c08c23bb06a.tar.bz2 u-boot-77ed7a2ac975e4b72a1bd87e5c475c08c23bb06a.zip |
IOMUX: Fix buffer overflow in iomux_replace_device()
Use of strcat() against an uninitialized buffer would lead
to buffer overflow. This patch fixes it.
Fixes: 694cd5618c ("IOMUX: Introduce iomux_replace_device()")
Signed-off-by: Yuichiro Goto <goto@k-tech.co.jp>
Cc: Peter Robinson <pbrobinson@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/iomux.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/common/iomux.c b/common/iomux.c index b9088aa3b5..c428f7110a 100644 --- a/common/iomux.c +++ b/common/iomux.c @@ -158,8 +158,12 @@ int iomux_replace_device(const int console, const char *old, const char *new) return -ENOMEM; } - strcat(tmp, ","); - strcat(tmp, name); + if (arg) { + strcat(tmp, ","); + strcat(tmp, name); + } + else + strcpy(tmp, name); arg = tmp; size = strlen(tmp) + 1; |