[OpenBIOS] [PATCH 2/2] libopenbios: don't allow find_package_method() to push a NULL for empty strings

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Jul 31 17:56:25 CEST 2016


Instead push a valid address with zero length otherwise the Forth find-method
word can reference a NULL pointer.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 libopenbios/bindings.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libopenbios/bindings.c b/libopenbios/bindings.c
index 4f7a993..926944d 100644
--- a/libopenbios/bindings.c
+++ b/libopenbios/bindings.c
@@ -161,7 +161,12 @@ my_self( void )
 xt_t
 find_package_method( const char *method, phandle_t ph )
 {
-	push_str( method );
+	if (method == NULL) {
+		push_str("");
+	} else {
+		push_str( method );
+	}
+	
 	PUSH_ph( ph );
 	fword("find-method");
 	if( POP() )
-- 
1.7.10.4




More information about the OpenBIOS mailing list