[v3,02/10] curl: change magic number to sizeof

Submitted by Fam Zheng on May 20, 2013, 7:03 a.m.

Details

Message ID 1369033424-14594-3-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng May 20, 2013, 7:03 a.m.
String field length is duplicated in two places. Make it a sizeof.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/curl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/block/curl.c b/block/curl.c
index 0aede58..901deb2 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -567,7 +567,7 @@  static void curl_readv_bh_cb(void *p)
     state->orig_buf = g_malloc(state->buf_len);
     state->acb[0] = acb;
 
-    snprintf(state->range, 127, "%zd-%zd", start, end);
+    snprintf(state->range, sizeof(state->range) - 1, "%zd-%zd", start, end);
     DPRINTF("CURL (AIO): Reading %d at %zd (%s)\n",
             (acb->nb_sectors * SECTOR_SIZE), start, state->range);
     curl_easy_setopt(state->curl, CURLOPT_RANGE, state->range);