Johannes Sixt <j.sixt@xxxxxxxxxxxxx> wrote: > Shawn O. Pearce schrieb: > > +static void rp_error(const char *err, ...) __attribute__((format (printf, 1, 2))); > > +static void rp_warning(const char *err, ...) __attribute__((format (printf, 1, 2))); > > + > > +static void report_message(const char *prefix, const char *err, va_list params) > > +{ > > + int sz = strlen(prefix); > > + char msg[4096]; > > + > > + strncpy(msg, prefix, sz); > > + sz += vsnprintf(msg + sz, sizeof(msg) - (sz + 1), err, params); > > + msg[sz++] = '\n'; > > This writes beyond the buffer if it is too small because the return value > tells how many characters *would* have been written if it were > sufficiently large, no? Ugh. I don't code C often enough anymore. Thank you for catching that. > > +static void rp_warning(const char *err, ...) > > ... > > +static void rp_error(const char *err, ...) > > ... > > Looks like we need set_report_routine(). > > Or did you replace only selected error() and warning() calls by rp_error() > and rp_warning()? As described by others in the thread... I only replaced selected calls. Well, most of them, maybe too many. But I didn't want to expose everything to the client. So I added new functions. Yes, it was painful. I wasn't happy about it. But I also wasn't happy about exposing every message to the client over the side-band channel. -- Shawn. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html