Skip to content

Commit

Permalink
Fix 3 potential buffer overrun
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-cellier-aka-nice committed Jan 1, 2019
1 parent 1f61637 commit e5cd4fb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32ExternalPrims.c
Expand Up @@ -43,7 +43,7 @@ void *ioLoadModule(char *pluginName)
#ifdef UNICODE
int len = MultiByteToWideChar(CP_UTF8, 0, pluginName, -1, NULL, 0);
if (len <= 0) return 0; /* invalid UTF8 ? */
name = alloca(len);
name = alloca(len*sizeof(WCHAR));
if (MultiByteToWideChar(CP_UTF8, 0, pluginName, -1, name, len) == 0) return 0;
#else
name = pluginName;
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Utils.c
Expand Up @@ -26,7 +26,7 @@ int __cdecl sqMessageBox(DWORD dwFlags, const TCHAR *titleString, const TCHAR* f

buf = (TCHAR*) calloc(sizeof(TCHAR), 4096);
va_start(args, fmt);
_vsntprintf(buf, 4096, fmt, args);
_vsntprintf(buf, 4096-1, fmt, args);
va_end(args);

result = MessageBox(stWindow,buf,titleString,dwFlags|MB_SETFOREGROUND);
Expand Down
2 changes: 1 addition & 1 deletion platforms/win32/vm/sqWin32Window.c
Expand Up @@ -72,7 +72,7 @@ char vmPathA[MAX_PATH_UTF8 + 1]; /* full path to interpreter's directory */
WCHAR vmPathW[MAX_PATH + 1]; /* full path to interpreter's directory */
char vmNameA[MAX_PATH_UTF8 + 1]; /* name of the interpreter's executable UTF8 */
WCHAR vmNameW[MAX_PATH + 1]; /* name of the interpreter's executable UTF16 */
char windowTitle[MAX_PATH]; /* what should we display in the title? */
char windowTitle[MAX_PATH+1]; /* what should we display in the title? */
TCHAR squeakIniName[MAX_PATH+1]; /* full path and name to ini file */
TCHAR windowClassName[MAX_PATH+1]; /* Window class name */

Expand Down

0 comments on commit e5cd4fb

Please sign in to comment.