]> git.proxmox.com Git - qemu.git/commitdiff
libcacard/vcard_emul_nss: use pstrcpy in place of strncpy
authorJim Meyering <meyering@redhat.com>
Thu, 4 Oct 2012 11:09:59 +0000 (13:09 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 5 Oct 2012 12:58:38 +0000 (07:58 -0500)
Replace strncpy+NUL-terminate use with use of pstrcpy.
This requires linking with cutils.o (or else vssclient doesn't link),
so add that in the Makefile.

Acked-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
libcacard/Makefile
libcacard/vcard_emul_nss.c

index 63990b70036e536880c34874f5d7f0ddca1f13b6..487f43489430d269fd95c496d96b80c788a7c18f 100644 (file)
@@ -14,6 +14,9 @@ QEMU_CFLAGS+=-I../
 
 libcacard.lib-y=$(patsubst %.o,%.lo,$(libcacard-y))
 
+vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o cutils.o
+       $(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) $(LIBS),"  LINK  $@")
+
 clean:
        rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient *.lo */*.lo .libs/* */.libs/* *.la */*.la *.pc
        rm -Rf .libs */.libs
index 802cae3a291bc4e0b1e40a520ad467d6e6f067f1..e1cae5bc51225156b52017bde499ac05bfac2314 100644 (file)
@@ -1169,8 +1169,7 @@ vcard_emul_options(const char *args)
             NEXT_TOKEN(vname)
             NEXT_TOKEN(type_params)
             type_params_length = MIN(type_params_length, sizeof(type_str)-1);
-            strncpy(type_str, type_params, type_params_length);
-            type_str[type_params_length] = 0;
+            pstrcpy(type_str, type_params_length, type_params);
             type = vcard_emul_type_from_string(type_str);
 
             NEXT_TOKEN(type_params)