Skip to content

Commit 6bf12bf

Browse files
committed
Use snprintf instead of sprintf
To get rid of warnings on MacOS. This should probably be patched upstream, but that project seem to be deprecated. See gohugoio/hugo#10629
1 parent d38eb98 commit 6bf12bf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libsass_src/src/json.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,10 @@ static void emit_number(SB *out, double num)
12861286
* like 0.3 -> 0.299999999999999988898 .
12871287
*/
12881288
char buf[64];
1289-
sprintf(buf, "%.16g", num);
1289+
// patched by @bep to get rid of warning on MacOS:
1290+
// "due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead".
1291+
//sprintf(buf, "%.16g", num);
1292+
snprintf(buf, sizeof(buf), "%.16g", num);
12901293

12911294
if (number_is_valid(buf))
12921295
sb_puts(out, buf);

0 commit comments

Comments
 (0)