shithub: mq

Download patch

ref: 4d09034e2a37db351b93ca0b1e65bce67f49d2e3
parent: 5f36cf56b3b455b72c45906b13e12c858695c746
author: kvik <kvik@a-b.xyz>
date: Fri Dec 4 22:33:44 EST 2020

mq: fix use after free

--- a/src/mq.c
+++ b/src/mq.c
@@ -365,8 +365,8 @@
 	cmd = parsecmd(r->ifcall.data, r->ifcall.count);
 	t = lookupcmd(cmd, mqcmd, nelem(mqcmd));
 	if(t == nil){
-		free(cmd);
 		respondcmderror(r, cmd, "%r");
+		free(cmd);
 		return;
 	}
 	switch(t->index){