]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
PRVM: fix null ptr deref in VM_getkeybind()
authorbones_was_here <bones_was_here@xonotic.au>
Sun, 31 Mar 2024 19:21:01 +0000 (05:21 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Mon, 1 Apr 2024 10:42:25 +0000 (20:42 +1000)
Breaking commit was 26a665ff43052862131df3c63785f91861989fc8

Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/133

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
prvm_cmds.c

index f060570733eb2cdd19993634a8989b2c2acb15c3..6a19baff45df819cfb499a71809ce872d683377f 100644 (file)
@@ -3428,7 +3428,7 @@ void VM_getkeybind (prvm_prog_t *prog)
        else
                bindmap = 0; // consistent to "bind"
        bind = Key_GetBind((int)PRVM_G_FLOAT(OFS_PARM0), bindmap);
-       PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(prog, bind, strlen(bind));
+       PRVM_G_INT(OFS_RETURN) = bind ? PRVM_SetTempString(prog, bind, strlen(bind)) : 0;
 }
 
 /*