Skip to content

Commit

Permalink
Fix sprintf use for CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Dec 5, 2022
1 parent 6305043 commit dcb4661
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/escape_chars.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SEXP C_escape_chars_one(SEXP x) {
default:
//control characters need explicit \u00xx escaping
if (*cur >= 0x00 && *cur <= 0x1f){
sprintf(outcur, "\\u%04x", *cur);
snprintf(outcur, 7, "\\u%04x", *cur);
outcur += 5; //extra length
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/modp_numtoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ size_t modp_dtoa(double value, char* str, int prec)
which can be 100s of characters overflowing your buffers == bad
*/
if (value > thres_max) {
sprintf(str, "%e", neg ? -value : value);
snprintf(str, 13, "%e", neg ? -value : value);
return strlen(str);
}

Expand Down

0 comments on commit dcb4661

Please sign in to comment.