Commit 20470a83 authored by Erkki Seppälä's avatar Erkki Seppälä Committed by Ulrich Sibiller

XlibInt: Use strncpy+zero termination instead of strcpy to enforce buffer size

Possible overrun of 8192 byte fixed size buffer "buffer" by copying "ext->name" without length checking Reviewed-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: 's avatarAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Signed-off-by: 's avatarErkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 7576f5f1
......@@ -3528,9 +3528,10 @@ static int _XPrintDefaultError(
ext && (ext->codes.major_opcode != event->request_code);
ext = ext->next)
;
if (ext)
strcpy(buffer, ext->name);
else
if (ext) {
strncpy(buffer, ext->name, BUFSIZ);
buffer[BUFSIZ - 1] = '\0';
} else
buffer[0] = '\0';
}
(void) fprintf(fp, " (%s)\n", buffer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment