IOMUX: Fix buffer overflow in iomux_replace_device()
PATCH v3 1/1 IOMUX: Fix buffer overflow in iomux_replace_device()
Use of strcat() against an uninitialized buffer would lead to buffer overflow. This patch fixes it.
---
Changes for v3:
- Add a Fixes tag in commit message
- Refactor the patch per suggestion from Andy Shevchenko
Changes for v2:
- Add "IOMUX" in title
common/iomux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
common/iomux.c +6 -2
@@ -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 ;
Signature · 1 line
2.17.1
PATCH v3 1/1 IOMUX: Fix buffer overflow in iomux_replace_device()
Quoted 2 lines · Yuichiro Goto
Use of
strcat()against an uninitialized buffer would lead to buffer overflow. This patch fixes it.
Quoted 39 lines
Fixes 694cd5618c ("IOMUX: Introduce iomux_replace_device()")Signed-off-by Yuichiro Goto <[email protected]>Cc Peter Robinson <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>---
Changes for v3:
- Add a Fixes tag in commit message
- Refactor the patch per suggestion from Andy ShevchenkoChanges for v2:
- Add "IOMUX" in titlecommon/iomux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)common/iomux.c +6
-2@@ -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 ;Signature · 1 line
2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v3 1/1 IOMUX: Fix buffer overflow in iomux_replace_device()
In reply to Yuichiro GotoQuoted 9 lines · Yuichiro Goto
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 <[email protected]>Cc Peter Robinson <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>
On a RPi2/RPi3 and Cubieboard
Quoted 34 lines
---
Changes for v3:
- Add a Fixes tag in commit message
- Refactor the patch per suggestion from Andy ShevchenkoChanges for v2:
- Add "IOMUX" in titlecommon/iomux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)common/iomux.c +6
-3@@ -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 ; --2.17.1
PATCH v3 1/1 IOMUX: Fix buffer overflow in iomux_replace_device()
In reply to Yuichiro GotoQuoted 10 lines · Yuichiro Goto
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 <[email protected]>Cc Peter Robinson <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Nicolas Saenz Julienne <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Tested-by Peter Robinson <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210427/1776de39/attachment.sig>