eina_strlcpy!!!

On Fri, Dec 13, 2013 at 10:32 AM, Carsten Haitzler <[email protected]> wrote:
> raster pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=8cdef1831c2cbdad9fc3bb8b03601d76ebe15a94
>
> commit 8cdef1831c2cbdad9fc3bb8b03601d76ebe15a94
> Author: Carsten Haitzler (Rasterman) <[email protected]>
> Date:   Fri Dec 13 16:27:04 2013 +0900
>
>     ecore-con - fix possible unterminated buffers
>
>     this should fix CID 1039725 and CID 1039724
> ---
>  src/lib/ecore_con/ecore_con_local.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/src/lib/ecore_con/ecore_con_local.c 
> b/src/lib/ecore_con/ecore_con_local.c
> index df86334..54dde17 100644
> --- a/src/lib/ecore_con/ecore_con_local.c
> +++ b/src/lib/ecore_con/ecore_con_local.c
> @@ -91,7 +91,10 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
>          if (svr->port < 0)
>            {
>               if (svr->name[0] == '/')
> -               strncpy(buf, svr->name, sizeof(buf));
> +               {
> +                  strncpy(buf, svr->name, sizeof(buf) - 1);
> +                  buf[sizeof(buf) - 1] = 0;
> +               }
>               else
>                 snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", 
> svr->name);
>            }
> @@ -108,8 +111,10 @@ ecore_con_local_connect(Ecore_Con_Server *svr,
>            }
>       }
>     else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
> -     strncpy(buf, svr->name,
> -             sizeof(buf));
> +     {
> +        strncpy(buf, svr->name, sizeof(buf) - 1);
> +        buf[sizeof(buf) - 1] = 0;
> +     }
>
>     svr->fd = socket(AF_UNIX, SOCK_STREAM, 0);
>     if (svr->fd < 0)
> @@ -251,8 +256,10 @@ ecore_con_local_listen(
>                     svr->port);
>       }
>     else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
> -     strncpy(buf, svr->name,
> -             sizeof(buf));
> +     {
> +        strncpy(buf, svr->name, sizeof(buf) - 1);
> +        buf[sizeof(buf) - 1] = 0;
> +     }
>
>     pmode = umask(mask);
>  start:
>
> --
>
>



-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (19) 9225-2202
Contact: http://www.gustavobarbieri.com.br/contact

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to