mirror of
https://github.com/ipxe/ipxe
synced 2025-12-13 23:41:45 +03:00
[script] Avoid trying to read final character of a zero-length string
Detected using Valgrind. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -92,11 +92,11 @@ static int process_script ( struct image *image,
|
|||||||
script_offset += ( frag_len + 1 );
|
script_offset += ( frag_len + 1 );
|
||||||
|
|
||||||
/* Strip trailing CR, if present */
|
/* Strip trailing CR, if present */
|
||||||
if ( line[ len - 1 ] == '\r' )
|
if ( len && ( line[ len - 1 ] == '\r' ) )
|
||||||
len--;
|
len--;
|
||||||
|
|
||||||
/* Handle backslash continuations */
|
/* Handle backslash continuations */
|
||||||
if ( line[ len - 1 ] == '\\' ) {
|
if ( len && ( line[ len - 1 ] == '\\' ) ) {
|
||||||
len--;
|
len--;
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user