[CRIU] [PATCH] Don't use strlcpy in libcriu

Kir Kolyshkin kir at openvz.org
Thu Oct 8 13:52:39 PDT 2015


On 10/08/2015 01:33 PM, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at openvz.org>
>
> ../../lib/libcriu.so: undefined reference to `strlcpy'
>
> Reported-by: Mr Jenkins
> Cc: Kir Kolyshkin <kir at openvz.org>
> Fixes: e5654e586cf5 ("Use strlcpy")
> Signed-off-by: Andrew Vagin <avagin at openvz.org>
> ---
>   lib/criu.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/criu.c b/lib/criu.c
> index b53ea38..537304d 100644
> --- a/lib/criu.c
> +++ b/lib/criu.c
You might also need to add this hunk:

@@ -13,7 +13,6 @@
  #include <alloca.h>

  #include "criu.h"
-#include "string.h"
  #include "rpc.pb-c.h"
  #include "cr-service-const.h"

> @@ -882,9 +882,9 @@ static int criu_connect(criu_opts *opts)


>   	memset(&addr, 0, sizeof(addr));
>   	addr.sun_family = AF_LOCAL;
>   
> -	strlcpy(addr.sun_path, opts->service_address, sizeof(addr.sun_path));
> +	strncpy(addr.sun_path, opts->service_address, sizeof(addr.sun_path));
>   
> -	addr_len = strlen(addr.sun_path) + sizeof(addr.sun_family);
> +	addr_len = strlen(opts->service_address) + sizeof(addr.sun_family);
>   
>   	ret = connect(fd, (struct sockaddr *) &addr, addr_len);
>   	if (ret < 0) {



More information about the CRIU mailing list