Re: [PATCH 8/6] receive-pack: Send internal errors over side-band #2
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Feb 10, 2010, 07:13 UTC
- Message-ID
- <4B725CB1.1080908@viscovery.net>
- In-Reply-To
- <1265767290-25863-2-git-send-email-spearce@spearce.org>
Shawn O. Pearce schrieb:
Show 11 quoted lines
> +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?
Show 11 quoted lines
> + > + if (use_sideband) > + send_sideband(1, 2, msg, sz, use_sideband); > + else > + xwrite(2, msg, sz); > +} > + > +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()?
-- Hannes