]> granicus.if.org Git - strace/commitdiff
pathtrace.c: use xsprintf instead of sprintf
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 6 Jan 2018 01:45:16 +0000 (01:45 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 7 Jan 2018 00:05:42 +0000 (00:05 +0000)
* pathtrace.c: Include "xstring.h".
(getfdpath): Replace sprintf with xsprintf.

pathtrace.c

index 3e4f5f8e14a51118a86a36addff7774d624e4e3e..524e80bcf92da953c4b9a317578c918d1eb49bed 100644 (file)
@@ -32,6 +32,7 @@
 #include <poll.h>
 
 #include "syscall.h"
+#include "xstring.h"
 
 struct path_set global_path_set;
 
@@ -105,7 +106,7 @@ getfdpath(struct tcb *tcp, int fd, char *buf, unsigned bufsize)
        if (fd < 0)
                return -1;
 
-       sprintf(linkpath, "/proc/%u/fd/%u", tcp->pid, fd);
+       xsprintf(linkpath, "/proc/%u/fd/%u", tcp->pid, fd);
        n = readlink(linkpath, buf, bufsize - 1);
        /*
         * NB: if buf is too small, readlink doesn't fail,