]> git.sesse.net Git - vlc/commitdiff
dshow.cpp: make sure driver name is properly NULL terminated
authorDamien Fouilleul <damienf@videolan.org>
Fri, 16 Sep 2005 16:13:07 +0000 (16:13 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Fri, 16 Sep 2005 16:13:07 +0000 (16:13 +0000)
modules/access/dshow/dshow.cpp

index 657a975e4e0e34333bc516d3bd33f56534943b28..27e4e822f2b4a7fb3d0e413f001121a3a6b0ce73 100644 (file)
@@ -1112,10 +1112,11 @@ FindCaptureDevice( vlc_object_t *p_this, string *p_devicename,
             {
                 int i_convert = WideCharToMultiByte(CP_ACP, 0, var.bstrVal,
                         SysStringLen(var.bstrVal), NULL, 0, NULL, NULL);
-                char *p_buf = (char *)alloca( i_convert ); p_buf[0] = 0;
+                char *p_buf = (char *)alloca( i_convert+1 ); p_buf[0] = 0;
                 WideCharToMultiByte( CP_ACP, 0, var.bstrVal,
                         SysStringLen(var.bstrVal), p_buf, i_convert, NULL, NULL );
                 SysFreeString(var.bstrVal);
+                p_buf[i_convert] = '\0';
 
                 if( p_listdevices ) p_listdevices->push_back( p_buf );