strndup() may be called on a string which is not NUL-terminated. Use strnlen() instead of strlen() to ensure that we do not read beyond the end of such a string. Add self-tests for strndup(), including a test case with an unterminated string. Originally-fixed-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
337 |
|
337 |
|
338 |
|
338 |
|
339 |
|
339 |
|
340 |
|
|
|
|
340 |
|
|
341 |
|
341 |
|
342 |
|
342 |
|
343 |
|
|
|
344 |
|
|
|
345 |
|
343 |
|
346 |
|
344 |
|
347 |
|
345 |
|
|
|
||
134 |
|
134 |
|
135 |
|
135 |
|
136 |
|
136 |
|
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
137 |
|
157 |
|
138 |
|
158 |
|
139 |
|
159 |
|