mirror of
https://github.com/xcat2/xNBA.git
synced 2024-11-22 17:41:55 +00: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:
parent
30de9e8300
commit
e52c24492a
@ -92,11 +92,11 @@ static int process_script ( struct image *image,
|
||||
script_offset += ( frag_len + 1 );
|
||||
|
||||
/* Strip trailing CR, if present */
|
||||
if ( line[ len - 1 ] == '\r' )
|
||||
if ( len && ( line[ len - 1 ] == '\r' ) )
|
||||
len--;
|
||||
|
||||
/* Handle backslash continuations */
|
||||
if ( line[ len - 1 ] == '\\' ) {
|
||||
if ( len && ( line[ len - 1 ] == '\\' ) ) {
|
||||
len--;
|
||||
rc = -EINVAL;
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user