We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 781bb48 commit 5c88190Copy full SHA for 5c88190
runtime/str.c
@@ -411,7 +411,9 @@ CAMLexport value caml_alloc_sprintf(const char * format, ...)
411
excluding the terminating '\0'. */
412
n = vsnprintf(buf, sizeof(buf), format, args);
413
va_end(args);
414
- if (n < sizeof(buf)) {
+ if (n < 0) {
415
+ caml_raise_out_of_memory();
416
+ } else if (n < sizeof(buf)) {
417
/* All output characters were written to buf, including the
418
terminating '\0'. Allocate a Caml string with length "n"
419
as computed by vsnprintf, and copy the output of vsnprintf into it. */
0 commit comments