From 536d754a8941976b3797a2775998ae7de89c19ec Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 24 Apr 2012 11:51:05 +0200 Subject: [PATCH] Deleting rooms: Invalid pointers; safeguarrds - Server return buffer wasn't allocated -> crash - add mandatory parameter 'go' to delete_room, so we're realy shure which room to delete. --- webcit/roomops.c | 34 +++++++++++++++--------- webcit/static/t/room/edit/tab_admin.html | 2 +- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/webcit/roomops.c b/webcit/roomops.c index edc09dec0..09534742e 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -354,20 +354,30 @@ void ParseGoto(folder *room, StrBuf *Line) */ void delete_room(void) { - StrBuf *Line; + StrBuf *Line = NewStrBuf(); + const StrBuf *GoBstr; - serv_puts("KILL 1"); - StrBuf_ServGetln(Line); - if (GetServerStatusMsg(Line, NULL, 1, 2) != 2) { - display_main_menu(); - } else { - StrBuf *Buf; - - FlushRoomlist (); - Buf = NewStrBufPlain(HKEY("_BASEROOM_")); - smart_goto(Buf); - FreeStrBuf(&Buf); + GoBstr = sbstr("go"); + + if (GoBstr != NULL) + { + if (gotoroom(GoBstr) == 200) + { + serv_puts("KILL 1"); + StrBuf_ServGetln(Line); + if (GetServerStatusMsg(Line, NULL, 1, 2) == 2) { + StrBuf *Buf; + + FlushRoomlist (); + Buf = NewStrBufPlain(HKEY("_BASEROOM_")); + smart_goto(Buf); + FreeStrBuf(&Buf); + FreeStrBuf(&Line); + return; + } + } } + display_main_menu(); FreeStrBuf(&Line); } diff --git a/webcit/static/t/room/edit/tab_admin.html b/webcit/static/t/room/edit/tab_admin.html index 896c7ca14..82962de87 100644 --- a/webcit/static/t/room/edit/tab_admin.html +++ b/webcit/static/t/room/edit/tab_admin.html @@ -1,7 +1,7 @@