Fix use of strncpy, which is actually good to use memcpy.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 6 Sep 2018 02:41:13 +0000 (11:41 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 6 Sep 2018 02:41:13 +0000 (11:41 +0900)
* common/ssh-utils.c (get_fingerprint): Use memcpy.
* g10/build-packet.c (string_to_notation): Use memcpy.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
common/ssh-utils.c
g10/build-packet.c

index 38d6e8a..013b28e 100644 (file)
@@ -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++ = ':';
 
index b4e03d0..3c500d3 100644 (file)
@@ -1297,7 +1297,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)