Re: [PATCH vdagent] Fixing buffer overflow when reloading wallpaper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ah thanks for the expanded commit log!

Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

On Mon, Aug 01, 2016 at 01:22:40PM +0300, Sameeh Jubran wrote:
> The function "SystemParametersInfo" expects the size of the
> buffer in characters. When wchar is used instead of char - two
> bytes instead of one byte per character -, then "sizeof" returns wrong
> number of characters (twice as much). A suitable solution would be to use
> SPICE_N_ELEMENTS.
> 
> Based on patch by Sandy Stutsman <sstutsma@xxxxxxxxxx>
> 
> Signed-off-by: Dmitry Fleytman <dfleytma@xxxxxxxxxx>
> Signed-off-by: Sameeh Jubran <sameeh@xxxxxxxxxx>
> ---
>  vdagent/display_setting.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/vdagent/display_setting.cpp b/vdagent/display_setting.cpp
> index 1ec7397..c261b67 100644
> --- a/vdagent/display_setting.cpp
> +++ b/vdagent/display_setting.cpp
> @@ -21,6 +21,7 @@
>  #include <tlhelp32.h>
>  #include "display_setting.h"
>  #include "vdlog.h"
> +#include "spice-protocol/spice/macros.h"
>  
>  enum DisplaySettingFlags {
>      DISPLAY_SETTING_FLAGS_DISABLE_WALLPAPER = (1 << 0),
> @@ -306,7 +307,7 @@ bool DisplaySetting::reload_wallpaper(HKEY desktop_reg_key)
>          wallpaper_path[value_size] = '\0';
>      }
>  
> -    if (SystemParametersInfo(SPI_GETDESKWALLPAPER, sizeof(cur_wallpaper), cur_wallpaper, 0)) {
> +    if (SystemParametersInfo(SPI_GETDESKWALLPAPER, SPICE_N_ELEMENTS(cur_wallpaper), cur_wallpaper, 0)) {
>          if (_tcscmp(cur_wallpaper, TEXT("")) != 0) {
>              vd_printf("wallpaper wasn't disabled");
>              return true;
> -- 
> 2.5.5
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]