Commit 9d3186c4 authored by Flavio Ceolin's avatar Flavio Ceolin Committed by David Leach
Browse files

shell: utils: Fix buffer overrun in shell_spaces_trim

The third argument in memmove can possible be greater than remaining
buffer size. Just ensuring that memmove will changes bytes only inside
the string buffer and nothing else.

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
parent 2649e4c0
Loading
Loading
Loading
Loading
+1 −1
Changes for subsys/shell/shell_utils.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ void shell_spaces_trim(char *str)
					/* +1 for EOS */
					memmove(&str[i + 1],
						&str[j],
						len - shift + 1);
						len - j + 1);
					len -= shift;
					shift = 0U;
				}