With the commits f2f02675 and 5096d490 we have been converted in some files the 
call
from snprintf/sprintf/strcpy to xsnprintf. This patch converts the remaining 
calls
to snprintf with xsnprintf under the following conditions:

- The call to snprintf does not control the outcome of the command
  or the presence of truncation errors.
- A call to snprintf can generate a fatal error, directly or indirectly.

The other few remaining cases in which a call to snprintf can generate a soft 
error
have not been changed.

Signed-off-by: Elia Pinto <gitter.spi...@gmail.com>
---
 wrapper.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/wrapper.c b/wrapper.c
index 5dc4e15..0d44835 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -433,16 +433,11 @@ int xmkstemp(char *template)
 int git_mkstemp(char *path, size_t len, const char *template)
 {
        const char *tmp;
-       size_t n;
 
        tmp = getenv("TMPDIR");
        if (!tmp)
                tmp = "/tmp";
-       n = snprintf(path, len, "%s/%s", tmp, template);
-       if (len <= n) {
-               errno = ENAMETOOLONG;
-               return -1;
-       }
+       (void)xsnprintf(path, len, "%s/%s", tmp, template);
        return mkstemp(path);
 }
 
-- 
2.9.0.rc1.265.geb5d750

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to