From 617e5616ce889cec6acfc740a48451b43da16e96 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 19 Jun 2014 10:46:18 +0100 Subject: [PATCH] Add printf format attribute to buf_append() Fix the one (harmless) warning it generates in base64 encoding. Signed-off-by: David Woodhouse --- http.c | 5 +++-- openconnect-internal.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/http.c b/http.c index 31368b23..650606ad 100644 --- a/http.c +++ b/http.c @@ -45,7 +45,8 @@ struct oc_text_buf *buf_alloc(void) return calloc(1, sizeof(struct oc_text_buf)); } -void buf_append(struct oc_text_buf *buf, const char *fmt, ...) +void __attribute__ ((format (printf, 2, 3))) + buf_append(struct oc_text_buf *buf, const char *fmt, ...) { va_list ap; @@ -1546,7 +1547,7 @@ static void b64_frag(struct oc_text_buf *buf, int len, unsigned char *in) b64[3] = b64_table[in[2] & 0x3f]; out: b64[4] = 0; - buf_append(buf, b64); + buf_append(buf, "%s", b64); } /* State in vpninfo->proxy_auth_state */ diff --git a/openconnect-internal.h b/openconnect-internal.h index f9e84d33..2484be68 100644 --- a/openconnect-internal.h +++ b/openconnect-internal.h @@ -560,7 +560,8 @@ int prepare_stoken(struct openconnect_info *vpninfo); /* http.c */ struct oc_text_buf *buf_alloc(void); -void buf_append(struct oc_text_buf *buf, const char *fmt, ...); +void __attribute__ ((format (printf, 2, 3))) + buf_append(struct oc_text_buf *buf, const char *fmt, ...); int buf_error(struct oc_text_buf *buf); int buf_free(struct oc_text_buf *buf); char *openconnect_create_useragent(const char *base);