Skip to content

Commit 48bdf86

Browse files
peffgitster
authored andcommitted
compat/hstrerror: convert sprintf to snprintf
This is a trivially correct use of sprintf, as our error number should not be excessively long. But it's still nice to drop an sprintf call. Note that we cannot use xsnprintf here, because this is compat code which does not load git-compat-util.h. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f5691aa commit 48bdf86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/hstrerror.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ const char *githstrerror(int err)
1616
case TRY_AGAIN:
1717
return "Non-authoritative \"host not found\", or SERVERFAIL";
1818
}
19-
sprintf(buffer, "Name resolution error %d", err);
19+
snprintf(buffer, sizeof(buffer), "Name resolution error %d", err);
2020
return buffer;
2121
}

0 commit comments

Comments
 (0)