[pacman-dev] [PATCH 4/4] Change strcat function using for strncat
Xavier
shiningxc at gmail.com
Sun Oct 18 06:03:59 EDT 2009
On Sun, Oct 18, 2009 at 6:04 AM, Laszlo Papp <djszapi2 at gmail.com> wrote:
> * Size examined str* function usage is a common coding practice,
> because it's more safer to avoid breakage while using str* functions.
>
> Signed-off-by: Laszlo Papp <djszapi at archlinux.us>
> ---
> lib/libalpm/util.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
> index 553591d..41a5783 100644
> --- a/lib/libalpm/util.c
> +++ b/lib/libalpm/util.c
> @@ -105,7 +105,7 @@ int _alpm_makepath_mode(const char *path, mode_t mode)
> /* we have another path component- append the newest component to
> * existing string and create one more level of dir structure */
> strcat(incr, "/");
> - strcat(incr, ptr);
> + strncat(incr, ptr, strlen(ptr));
> if(access(incr, F_OK)) {
> if(mkdir(incr, mode)) {
> ret = 1;
This is useless too.
These two are equivalent, so we might as well go for the simpler one.
More information about the pacman-dev
mailing list