>>>>> Serguei Sokol >>>>> on Mon, 20 Nov 2023 10:04:10 +0100 writes:
> Le 19/11/2023 à 02:07, Iris Simmons a écrit : >> Yes, the reason for the error is the use of sprintf. You can instead use >> snprintf where n is the maximum number of bytes to write, including the >> terminating nul character. For example: >> >> char msg[8191]; >> snprintf(msg, 8191, "criteria: error (%d) -> %s\n", inErr, errStr); > This line should be > snprintf(msg, 8190, "criteria: error (%d) -> %s\n", inErr, errStr); > i.e. 1-less than 'msg' size, leaving a room for the terminal 0-byte. > Otherwise, a recent version of gcc emits a warning caught by CRAN. > Best, > Serguei. Yes, indeed ' - 1 ', but really Iago (and everyone else!) should in such cases use the much nicer and easier code that Ivan Krylov proposed yesterday : Rf_error("criteria: error (%d) -> %s", inErr, errStr); with *no* need of declaring a `msg` buffer and thinking about its size. Martin ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel