]> Git Repo - J-u-boot.git/commit - cmd/mtdparts.c
mtdparts: fixed buffer overflow bug
authorKay Potthoff <[email protected]>
Tue, 17 Jul 2018 06:19:39 +0000 (08:19 +0200)
committerTom Rini <[email protected]>
Tue, 24 Jul 2018 13:25:23 +0000 (09:25 -0400)
commit149c21b098dafc5a2ae619555a844e8d0a9523f6
treefd593e065804edfe31d57678b19823cfccd4880f
parent4807c40c2f145e9721fc7891730cb26043cbd723
mtdparts: fixed buffer overflow bug

In the case that there was no name defined for a partition the
code assumes that name_len is 22 and therefore allocates exactly
that space for a dummy name. But the function sprintf() first
resolves "0x%08llx@0x%08llx" to a string that is longer than 22
bytes. This leads to a buffer overflow. The replacement function
snprintf() limits the copied bytes to name_len and therefore
avoids the buffer overflow.

Signed-off-by: Kay Potthoff <[email protected]>
cmd/mtdparts.c
This page took 0.034507 seconds and 4 git commands to generate.