From 89ab2a529c8cc3f9ec29d0c51065c10a56eea8b2 Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Mon, 1 Apr 2024 05:21:01 +1000 Subject: [PATCH] PRVM: fix null ptr deref in VM_getkeybind() Breaking commit was 26a665ff43052862131df3c63785f91861989fc8 Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/133 Signed-off-by: bones_was_here --- prvm_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prvm_cmds.c b/prvm_cmds.c index f06057073..6a19baff4 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -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; } /*