On Mon, Jun 07, 2010 at 03:24:32AM +0700, Mikhail Gusarov wrote:
> The only caller of Win32System is XkbDDXCompileKeymapByNames. Add allocation
> check there to avoid passing NULL pointers to various functions down the code.
> 
> Signed-off-by: Mikhail Gusarov <[email protected]>
> ---
> 
> In new version of patch NULL return value of Xprintf is explicitly guarded and
> dealt with.
> 
>  xkb/ddxLoad.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
> index b1d6294..f7bd667 100644
> --- a/xkb/ddxLoad.c
> +++ b/xkb/ddxLoad.c
> @@ -103,7 +103,7 @@ Win32System(const char *cmdline)
>      STARTUPINFO si;
>      PROCESS_INFORMATION pi;
>      DWORD dwExitCode;
> -    char *cmd = xstrdup(cmdline);
> +    char *cmd = strdup(cmdline);
>  
>      ZeroMemory( &si, sizeof(si) );
>      si.cb = sizeof(si);
> @@ -235,6 +235,11 @@ XkbDDXCompileKeymapByNames(      XkbDescPtr              
> xkb,
>                 xkm_output_dir, keymap);
>  
>      free(xkbbasedirflag);
> +
> +    if (!buf) {
> +        LogMessage(X_Error, "XKB: Could not invoke xkbcomp: not enough 
> memory\n");
> +        return FALSE;
> +    }
>      
>  #ifndef WIN32
>      out= Popen(buf,"w");
> -- 
> 1.7.1

Reviewed-by: Peter Hutterer <[email protected]>

Cheers,
  Peter
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to