Skip to content

Commit

Permalink
Replace multiple strcat and strcpy by snprintf
Browse files Browse the repository at this point in the history
Patch by Florian Obser
  • Loading branch information
k0ekk0ek committed Apr 3, 2024
1 parent da08d0e commit 6342f9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
3 April 2024: Jeroen
- Replace multiple strcat and strcpy by snprintf.

26 March 2024: Jeroen
- Test if debug is available in do-tests.
- Enforce timeout from NSD in ixfr_gone test.
Expand Down
1 change: 1 addition & 0 deletions doc/RELNOTES
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ BUG FIXES:
- Update expressions in ixfr_and_restart test.
- Make algorithm explicit in control-repattern test.
- Switch algorithm to hmac-256 for testplan_mess test.
- Replace multiple strcat and strcpy by snprintf.

4.8.0
================
Expand Down
9 changes: 4 additions & 5 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,13 @@ zone_list_member_zone_insert(struct nsd_options* opt, const char* nm,
"zone value provided in zone '%s' or pattern '%s'",
mem_idnm, nm, patnm);

else if(strlen(pat->catalog_producer_zone)
+ strlen(mem_idnm) + 9 > sizeof(member_id_str))
else if(snprintf(member_id_str, sizeof(member_id_str),
"%s.zones.%s", mem_idnm, pat->catalog_producer_zone) >=
(int)sizeof(member_id_str))
log_msg(LOG_ERR, "syntax error in member ID '%s.zones.%s' for "
"zone '%s'", mem_idnm, pat->catalog_producer_zone, nm);

else if(!(cmz->member_id = dname_parse(opt->region, strcat(strcat(
strcpy(member_id_str, mem_idnm),".zones."),
pat->catalog_producer_zone))))
else if(!(cmz->member_id = dname_parse(opt->region, member_id_str)))
log_msg(LOG_ERR, "parse error in member ID '%s' for "
"zone '%s'", member_id_str, nm);
return zone;
Expand Down

0 comments on commit 6342f9e

Please sign in to comment.