Commit c989414
LIB: Fix potential NULL pointer dereference
In tfm_vprintf.c, if the calculate_length flag is set and the string
passed to output_str is NULL, then the program would dereference the
NULL pointer as per the following warning:
warning: potential null pointer dereference [-Wnull-dereference]
64 | while (*str_ptr++ != '\0') {
| ^~~~~~~~~~
Fix this by adding an assertion that the string is non-NULL and
returning from the function in the case of release builds.
Change-Id: Ibc9fe50a19c8255298ea69b22770f8a255ad9266
Signed-off-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com>
(cherry picked from commit 3e369bd)
Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com>1 parent 9b079f7 commit c989414
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
| |||
0 commit comments