renderer: fix copying of context name

Context name length was being ignored and strncpy does not enforce
null termination but the destination was being used as a null terminated
string.

Change-Id: I715394b364130578a1a6a319dc16927261523d71
Signed-off-by: David Riley <davidriley@chromium.org>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
macos/master
David Riley 6 years ago committed by Gert Wollny
parent 815539e1d8
commit 0a1ce32f21
  1. 5
      src/vrend_renderer.c

@ -5557,7 +5557,10 @@ struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *de
return NULL;
if (nlen && debug_name) {
strncpy(grctx->debug_name, debug_name, 64);
strncpy(grctx->debug_name, debug_name,
nlen < sizeof(grctx->debug_name) - 1 ?
nlen : sizeof(grctx->debug_name) - 1);
grctx->debug_name[sizeof(grctx->debug_name) - 1] = 0;
}
VREND_DEBUG(dbg_caller, grctx, "create context\n");

Loading…
Cancel
Save