Opened 3 years ago
Closed 3 years ago
#7315 closed defect (fixed)
PDBio.cpp buffer overflow
| Reported by: | Tom Goddard | Owned by: | Eric Pettersen |
|---|---|---|---|
| Priority: | moderate | Milestone: | |
| Component: | Input/Output | Version: | |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
Noticed this nice warning on the Mac M1 build output.
pdbio_cpp/PDBio.cpp:262:17: warning: 'sprintf' will always overflow; destination buffer has size 4, but format string expands to at least 5 [-Wfortify-source]
std::sprintf(buffer, "%4d", ssbond_serial++);
Change History (2)
comment:1 by , 3 years ago
| Status: | assigned → accepted |
|---|
comment:2 by , 3 years ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.
Oooh, that _is_ nice. I didn't allocate space for the '\0' terminator in the buffer, though the bug would only actually have an effect for structures with 1000+ SSBONDs, so basically never.
fix: https://github.com/RBVI/ChimeraX/commit/b94a476dbc36216cb01de99c04b791311b4d354b