From: cloudwalk Date: Wed, 10 Jun 2020 05:08:41 +0000 (+0000) Subject: Clamp clipboard data to MAX_INPUTLINE. Fixes heap overflow with console input X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0118a30eba01aef1ad0bbab03c383b382acad183;p=xonotic%2Fdarkplaces.git Clamp clipboard data to MAX_INPUTLINE. Fixes heap overflow with console input https://gitlab.com/xonotic/darkplaces/-/merge_requests/84 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12662 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sys_sdl.c b/sys_sdl.c index 81984861..e3b2956e 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -173,7 +173,7 @@ char *Sys_GetClipboardData (void) cliptext = SDL_GetClipboardText(); if (cliptext != NULL) { size_t allocsize; - allocsize = strlen(cliptext) + 1; + allocsize = min(MAX_INPUTLINE, strlen(cliptext) + 1); data = (char *)Z_Malloc (allocsize); strlcpy (data, cliptext, allocsize); SDL_free(cliptext);