From: NIIBE Yutaka Date: Thu, 6 Sep 2018 02:41:13 +0000 (+0900) Subject: Fix use of strncpy, which is actually good to use memcpy. X-Git-Tag: archive/raspbian/2.2.10-3+rpi1^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a615b1367519c07c04eea39bf02aa4f4229d24f0;p=gnupg2.git Fix use of strncpy, which is actually good to use memcpy. * common/ssh-utils.c (get_fingerprint): Use memcpy. * g10/build-packet.c (string_to_notation): Use memcpy. -- Cherry-pick of master commit of: 625ced6e672daa892d334323cce6b3d42a6f929f Signed-off-by: NIIBE Yutaka (cherry picked from commit f0fdee2e24a25f57a84e1684984ce3921d923e0a) Gbp-Pq: Name Fix-use-of-strncpy-which-is-actually-good-to-use-memcpy.patch --- diff --git a/common/ssh-utils.c b/common/ssh-utils.c index 38d6e8a..013b28e 100644 --- a/common/ssh-utils.c +++ b/common/ssh-utils.c @@ -247,7 +247,7 @@ get_fingerprint (gcry_sexp_t key, int algo, goto leave; } - strncpy (*r_fpr, algo_name, strlen (algo_name)); + memcpy (*r_fpr, algo_name, strlen (algo_name)); fpr = (char *) *r_fpr + strlen (algo_name); *fpr++ = ':'; diff --git a/g10/build-packet.c b/g10/build-packet.c index d4a1d6a..b83ea84 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -1266,7 +1266,7 @@ string_to_notation(const char *string,int is_utf8) } notation->name=xmalloc((s-string)+1); - strncpy(notation->name,string,s-string); + memcpy(notation->name,string,s-string); notation->name[s-string]='\0'; if(!saw_at && !opt.expert)