From: Ivan Maidanski Date: Fri, 9 Dec 2016 22:54:05 +0000 (+0300) Subject: Eliminate 'use of vulnerable sprintf' code defect in de_win test (cord) X-Git-Tag: v8.0.0~997 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbdd97254de38951a859e9a96cf08f77435bb05a;p=platform%2Fupstream%2Flibgc.git Eliminate 'use of vulnerable sprintf' code defect in de_win test (cord) * cord/tests/de_win.c (WinMain): Do not call sprintf() on RegisterClass and CreateWindow failure; invoke de_error() with the immediate error message strings (without the error code). --- diff --git a/cord/tests/de_win.c b/cord/tests/de_win.c index b36d864..0af00df 100644 --- a/cord/tests/de_win.c +++ b/cord/tests/de_win.c @@ -62,11 +62,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wndclass.lpszClassName = szAppName; if (RegisterClass (&wndclass) == 0) { - char buf[50]; - - sprintf(buf, "RegisterClass: error code: 0x%X", - (unsigned)GetLastError()); - de_error(buf); + de_error("RegisterClass error"); return(0); } } @@ -99,11 +95,7 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, NULL, /* Window class menu */ hInstance, NULL); if (hwnd == NULL) { - char buf[50]; - - sprintf(buf, "CreateWindow: error code: 0x%X", - (unsigned)GetLastError()); - de_error(buf); + de_error("CreateWindow error"); return(0); }