diff --git a/src/win/win_devconf.c b/src/win/win_devconf.c
index d738ab39e..5b1e80535 100644
--- a/src/win/win_devconf.c
+++ b/src/win/win_devconf.c
@@ -8,7 +8,7 @@
*
* Windows device configuration dialog implementation.
*
- * Version: @(#)win_devconf.c 1.0.16 2018/03/18
+ * Version: @(#)win_devconf.c 1.0.17 2018/03/20
*
* Authors: Sarah Walker,
* Miran Grca,
@@ -241,7 +241,7 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
val_int = config->spinner.min;
SendMessage(h, WM_GETTEXT, 79, (LPARAM)ws);
- wcstombs(s, ws, 79);
+ wcstombs(s, ws, 512);
sscanf(s, "%i", &c);
if (val_int != c)
@@ -330,7 +330,8 @@ deviceconfig_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
break;
case CONFIG_SPINNER:
- SendMessage(h, WM_GETTEXT, 79, (LPARAM)s);
+ SendMessage(h, WM_GETTEXT, 79, (LPARAM)ws);
+ wcstombs(s, ws, 512);
sscanf(s, "%i", &c);
if (c > config->spinner.max)
c = config->spinner.max;