From: Dotan Barak Date: Tue, 24 Apr 2012 18:20:55 +0000 (-0700) Subject: rping: Replace sprintf with snprintf to protect from buffer overflow X-Git-Tag: v1.0.16~39 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=5658ff385e0449a78a325d430163e524b7a97ec4;p=~shefty%2Flibrdmacm.git rping: Replace sprintf with snprintf to protect from buffer overflow Signed-off-by: Dotan Barak Signed-off-by: Sean Hefty --- diff --git a/examples/rping.c b/examples/rping.c index ee292eca..785338e3 100644 --- a/examples/rping.c +++ b/examples/rping.c @@ -909,7 +909,7 @@ static int rping_test_client(struct rping_cb *cb) cb->state = RDMA_READ_ADV; /* Put some ascii text in the buffer. */ - cc = sprintf(cb->start_buf, RPING_MSG_FMT, ping); + cc = snprintf(cb->start_buf, cb->size, RPING_MSG_FMT, ping); for (i = cc, c = start; i < cb->size; i++) { cb->start_buf[i] = c; c++;