git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Typo spotted in archive-tar.c

From
GPGreen, Paul <paul.green@stratus.com>
Date
May 24, 2016, 00:44 UTC
Message-ID
<CO2PR0801MB599926424BC99D7DFC2622B8E4F0@CO2PR0801MB599.namprd08.prod.outlook.com>
While examining (relatively) recent changes to git, my eye happened to notice the following inconsistency on line 184 of the current version of archive-tar.c. 
-    sprintf(header->chksum, "%07o", ustar_header_chksum(header));
+    snprintf(header->chksum, sizeof(header->chksum), "%07o", ustar_header_chksum(header));
I believe the author meant to invoke the xsnprintf function, not the snprintf function. I say this because all of the other references to sprintf were indeed changed to xsnprintf, with the necessary additional 2nd argument.
This change was applied September 24, 2015 (commit f2f026752993054c1b712b6f4ae3ff167db38cbe). 
See https://github.com/git/git/commit/f2f026752993054c1b712b6f4ae3ff167db38cbe#diff-d18f7cb5411066ed8eda566b26d2570c  for the full set of related changes to archive-tar.c.
Thanks
PG
--
Sr. Technical Consultant, Stratus Technologies, Inc.
5 Mill and Main, Suite 500, Maynard, MA 01754
Office: +1 (978) 461-7557, FAX: +1 (978) 461-3610
Next: Jeff King
Message 1 of 2 in “Typo spotted in archive-tar.c”
  1. Green, PaulMay 24, 2016
  2. archive-tar: convert snprintf to xsnprintfJeff King, May 26, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.