On Fri, Dec 13, 2013 at 10:32 AM, Carsten Haitzler <ras...@rasterman.com> wrote:
> raster pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=75fbf9e03a4b163091f7cb4e1ddac26bc241f42b
>
> commit 75fbf9e03a4b163091f7cb4e1ddac26bc241f42b
> Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
> Date:   Fri Dec 13 18:41:03 2013 +0900
>
>     ethumb - ensure buf is nul terminated
>
>     this SHOULD deal with CID 1039577  and CID 1039576
> ---
>  src/lib/ethumb/ethumb.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/ethumb/ethumb.c b/src/lib/ethumb/ethumb.c
> index 5104b0f..f1c5466 100644
> --- a/src/lib/ethumb/ethumb.c
> +++ b/src/lib/ethumb/ethumb.c
> @@ -698,13 +698,17 @@ _ethumb_build_absolute_path(const char *path, char 
> buf[PATH_MAX])
>     p = buf;
>
>     if (path[0] == '/')
> -     strcpy(p, path);
> +     {
> +        strncpy(p, path, PATH_MAX - 1);
> +        p[PATH_MAX - 1] = 0;
> +     }
>     else if (path[0] == '~')
>       {
>          const char *home = getenv("HOME");
>          if (!home)
>            return NULL;
> -        strcpy(p, home);
> +        strncpy(p, home, PATH_MAX - 1);
> +        p[PATH_MAX - 1] = 0;
>          len = strlen(p);
>          p += len;
>          p[0] = '/';
> @@ -719,7 +723,8 @@ _ethumb_build_absolute_path(const char *path, char 
> buf[PATH_MAX])
>          p += len;
>          p[0] = '/';
>          p++;
> -        strcpy(p, path);
> +        strncpy(p, path, PATH_MAX - 1 - len - 1);
> +        p[PATH_MAX - 1 - len - 1] = 0;

hey... eina_strlcpy(), please remember!!! Saves you a line, and is
cleaner... just need to remember we do ship this function!


-- 
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
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to