diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 37c44e2a..346c71fe 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -334,7 +334,11 @@ if(MSVC)
     add_compile_definitions(_CRT_NONSTDC_NO_WARNINGS=1)
     add_compile_definitions(_WINSOCK_DEPRECATED_NO_WARNINGS=1)
     add_compile_options(/W3)
+    add_compile_options(/wd4018) # warning C4018: signed/unsigned mismatch
+    add_compile_options(/wd4244) # warning C4244: conversion from '...' to '...', possible loss of data
+    add_compile_options(/wd4267) # warning C4267: conversion from '...' to '...', possible loss of data
     add_compile_options(/wd5105) # warning C5105: macro expansion producing 'xxx' has undefined behavior
+    add_compile_options(/wd6255) # warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
 
     set(EXTRA_WINDOWS_SOURCES ${EXTRA_WINDOWS_SOURCES}
         "${PROJECT_SOURCE_DIR}/msvc/getopt.c"
diff --git a/src/avrftdi.c b/src/avrftdi.c
index d9313932..e41d775e 100644
--- a/src/avrftdi.c
+++ b/src/avrftdi.c
@@ -356,15 +356,8 @@ static int avrftdi_transmit_bb(PROGRAMMER * pgm, unsigned char mode, const unsig
 	blocksize = MAX(1,(max_size-7)/((8*2*6)+(8*1*2)));
 	//avrdude_message(MSG_INFO, "blocksize %d \n",blocksize);
 
-	size_t send_buffer_size = (8 * 2 * 6) * blocksize + (8 * 1 * 2) * blocksize + 7;
-	size_t recv_buffer_size = 2 * 16 * blocksize;
-#ifdef _MSC_VER
-	unsigned char* send_buffer = _alloca(send_buffer_size);
-	unsigned char* recv_buffer = _alloca(recv_buffer_size);
-#else
-	unsigned char send_buffer[send_buffer_size];
-	unsigned char recv_buffer[recv_buffer_size];
-#endif
+	unsigned char* send_buffer = alloca((8 * 2 * 6) * blocksize + (8 * 1 * 2) * blocksize + 7);
+	unsigned char* recv_buffer = alloca(2 * 16 * blocksize);
 
 	while(remaining)
 	{
@@ -966,11 +959,7 @@ static int avrftdi_eeprom_read(PROGRAMMER *pgm, AVRPART *p, AVRMEM *m,
 {
 	unsigned char cmd[4];
 	unsigned int add;
-#ifdef _MSC_VER
-	unsigned char* buffer = _alloca(len);
-#else
-	unsigned char buffer[len];
-#endif
+	unsigned char* buffer = alloca(len);
 	unsigned char* bufptr = buffer;
 
 	memset(buffer, 0, len);
@@ -998,19 +987,14 @@ static int avrftdi_flash_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
 	
 	unsigned int word;
 	unsigned int poll_index;
-	unsigned int buf_size;
 
 	unsigned char poll_byte;
 	unsigned char *buffer = &m->buf[addr];
-	unsigned int alloc_size = 4 * len + 4;
-#ifdef _MSC_VER
-	unsigned char* buf = _alloca(alloc_size);
-#else
-	unsigned char buf[alloc_size];
-#endif
+	unsigned int buf_size = 4 * len + 4;
+	unsigned char* buf = alloca(buf_size);
 	unsigned char* bufptr = buf;
 
-	memset(buf, 0, alloc_size);
+	memset(buf, 0, buf_size);
 
 	/* pre-check opcodes */
 	if (m->op[AVR_OP_LOADPAGE_LO] == NULL) {
@@ -1127,13 +1111,8 @@ static int avrftdi_flash_read(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
 	unsigned int address = addr/2;
 
 	unsigned int buf_size = 4 * len + 4;
-#ifdef _MSC_VER
-	unsigned char* o_buf = _alloca(buf_size);
-	unsigned char* i_buf = _alloca(buf_size);
-#else
-	unsigned char o_buf[buf_size];
-	unsigned char i_buf[buf_size];
-#endif
+	unsigned char* o_buf = alloca(buf_size);
+	unsigned char* i_buf = alloca(buf_size);
 	unsigned int index;
 
 	memset(o_buf, 0, buf_size);
diff --git a/src/buspirate.c b/src/buspirate.c
index 84b2f042..e765797f 100644
--- a/src/buspirate.c
+++ b/src/buspirate.c
@@ -41,9 +41,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#if defined(WIN32NATIVE)
-#  include <malloc.h>  /* for alloca() */
-#endif
 
 #include "avrdude.h"
 #include "libavrdude.h"
diff --git a/src/msvc/msvc_compat.h b/src/msvc/msvc_compat.h
index 19acf5b8..aef86b05 100644
--- a/src/msvc/msvc_compat.h
+++ b/src/msvc/msvc_compat.h
@@ -22,11 +22,7 @@
 #include <stdlib.h>
 #include <io.h>
 #include <intrin.h> 
-
-#pragma warning(disable : 4018) // warning C4018: signed/unsigned mismatch
-#pragma warning(disable : 4244) // warning C4244: conversion from '...' to '...', possible loss of data
-#pragma warning(disable : 4267) // warning C4267: conversion from '...' to '...', possible loss of data
-#pragma warning(disable : 5105) // warning C5105: macro expansion producing 'defined' has undefined behavior
+#include <malloc.h> 
 
 #pragma comment(lib, "hid.lib")
 #pragma comment(lib, "ws2_32.lib")
diff --git a/src/stk500.c b/src/stk500.c
index 41bc4d06..ea87b899 100644
--- a/src/stk500.c
+++ b/src/stk500.c
@@ -760,11 +760,7 @@ static int stk500_paged_write(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
                               unsigned int page_size,
                               unsigned int addr, unsigned int n_bytes)
 {
-#ifdef _MSC_VER
-  unsigned char* buf = _alloca(page_size + 16);
-#else
-  unsigned char buf[page_size + 16];
-#endif
+  unsigned char* buf = alloca(page_size + 16);
   int memtype;
   int a_div;
   int block_size;