]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospfd: Fix Coverity Warning CID 1399480 (#1 of 1): Buffer not null terminated (BUFFER...
authorMartin Winter <mwinter@opensourcerouting.org>
Fri, 3 Feb 2017 11:09:36 +0000 (18:09 +0700)
committerMartin Winter <mwinter@opensourcerouting.org>
Fri, 10 Feb 2017 09:50:23 +0000 (16:50 +0700)
Coverity: buffer_size_warning: Calling strncpy with a maximum size argument of 100 bytes on destination array pid_file of size 100 bytes might leave the destination string unterminated.
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
ospfd/ospf_main.c

index 845d96032bc062aa023eedaf0a5a3b450cf6a00c..cc335a8abde9c6f5e4113243107717f22d74ca3c 100644 (file)
@@ -383,7 +383,7 @@ main (int argc, char **argv)
           pid_file[0] = '\0';
 
       snprintf(pidfile_temp, sizeof(pidfile_temp), "%s/ospfd-%d.pid", pid_file, instance );
-      strncpy(pid_file, pidfile_temp, sizeof(pid_file));
+      strlcpy(pid_file, pidfile_temp, sizeof(pid_file));
     }
   /* Process id file create. */
   pid_output (pid_file);