From 9a2ed9307a1869fd0b6d04adc98112fd027aa89a Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 7 Apr 2009 20:03:25 +0000 Subject: [PATCH] Quick fix for something that noone noticed. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3164 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/sys_npqtv.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/engine/client/sys_npqtv.c b/engine/client/sys_npqtv.c index 88b3b9e52..14ef45249 100644 --- a/engine/client/sys_npqtv.c +++ b/engine/client/sys_npqtv.c @@ -413,6 +413,14 @@ void DrawWndBack(struct context *ctx, HWND hWnd, HDC hdc, PAINTSTRUCT *p) PatBlt(hdc, p->rcPaint.left, p->rcPaint.top, p->rcPaint.right-p->rcPaint.left,p->rcPaint.bottom-p->rcPaint.top,PATCOPY); } +char *cleanarg(char *arg) +{ + //no hacking us, please. + while (*arg == '-' || *arg == '+') + arg++; + return arg; +} + LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { struct qstream *str; @@ -506,30 +514,30 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar break; case QTVCT_STREAM: argv[argc++] = "+qtvplay"; - argv[argc++] = ctx->qtvf.server; + argv[argc++] = cleanarg(ctx->qtvf.server); break; case QTVCT_CONNECT: argv[argc++] = "+connect"; - argv[argc++] = ctx->qtvf.server; + argv[argc++] = cleanarg(ctx->qtvf.server); break; case QTVCT_JOIN: argv[argc++] = "+join"; - argv[argc++] = ctx->qtvf.server; + argv[argc++] = cleanarg(ctx->qtvf.server); break; case QTVCT_OBSERVE: argv[argc++] = "+observe"; - argv[argc++] = ctx->qtvf.server; + argv[argc++] = cleanarg(ctx->qtvf.server); break; case QTVCT_MAP: argv[argc++] = "+map"; - argv[argc++] = ctx->qtvf.server; + argv[argc++] = cleanarg(ctx->qtvf.server); break; } if (ctx->password) { argv[argc++] = "+password"; - argv[argc++] = ctx->password; + argv[argc++] = cleanarg(ctx->password); } //figure out the game dirs (first token is the base game) @@ -550,13 +558,15 @@ LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar else { argv[argc++] = "-basegame"; - argv[argc++] = strdup(com_token); //FIXME: this will leak + argv[argc++] = strdup(cleanarg(com_token)); //FIXME: this will leak } //later options are additions to that while ((s = COM_ParseOut(s, com_token, sizeof(com_token)))) { + if (argc == sizeof(argv)/sizeof(argv[0])) + break; argv[argc++] = "-addbasegame"; - argv[argc++] = strdup(com_token); //FIXME: this will leak + argv[argc++] = strdup(cleanarg(com_token)); //FIXME: this will leak } sys_parentwidth = ctx->window.width;