[CDRIVER-4091] Truncation in strncpy() causes build error Created: 16/Jul/21 Updated: 28/Oct/23 Resolved: 26/Jul/21 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | Build, errors |
| Affects Version/s: | None |
| Fix Version/s: | 1.19.0 |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Jesse Williamson (Inactive) | Assignee: | Jesse Williamson (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
gcc complains that because the destination length is computed based on the source string, the trailing NULL won't be copied: test->cursor_ns = (char *) bson_malloc0 (strlen (temp));
|
| Comments |
| Comment by Githook User [ 19/Jul/21 ] |
|
Author: {'name': 'Jesse Williamson', 'email': 'nerd.cpp@gmail.com', 'username': 'chardan'}Message: https://jira.mongodb.org/browse/CDRIVER-4091 gcc 9.3.0 complains that because the strncpy() call uses the source's size as a bound, Replaced with: Signed-off-by: Jesse Williamson <jesse.williamson@mongodb.com> |
| Comment by Jesse Williamson (Inactive) [ 16/Jul/21 ] |