mfd: ipaq-micro: Fix out-of-bounds stack read in ipaq_micro_str
PATCH 1/1 mfd: ipaq-micro: Fix out-of-bounds stack read in ipaq_micro_str
ipaq_micro_str() decodes a UTF-16LE string into an ASCII string. It copies characters to a stack buffer retstr, but fails to null-terminate it. When kstrdup() is called on retstr, it can read past the buffer into uninitialized stack memory, potentially leaking stack contents.
Fix this by initializing retstr to zero.
--- drivers/mfd/ipaq-micro.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/ipaq-micro.c +1 -1
@@ -221,7 +221,7 @@ static void ipaq_micro_eeprom_read(struct ipaq_micro *micro,static char *ipaq_micro_str (u8 *wchar,u8 len) { -char retstr[256 ]; +char retstr[256 ] = {0 };u8 i;for (i =0 ; i < len /2 ; i++)
Signature · 5 lines
2.54.0.1099.g489fc7bff1-goog -- Dmitry
Re: (subset) [PATCH] mfd: ipaq-micro: Fix out-of-bounds stack read in ipaq_micro_str
Quoted 9 lines · Dmitry Torokhov
ipaq_micro_str()decodes a UTF-16LE string into an ASCII string. It copies characters to a stack buffer retstr, but fails to null-terminate it. Whenkstrdup()is called on retstr, it can read past the buffer into uninitialized stack memory, potentially leaking stack contents.Fix this by initializing retstr to zero.
[...]
Applied, thanks!
[1/1] mfd: ipaq-micro: Fix out-of-bounds stack read in ipaq_micro_str
commit: 12d6d600e93bb15006109df42983d1236bb99a50
--
Lee Jones [李琼斯]