Skip to contentSkip to conversation

rping: security fix: replace sprintf with snprintf

PATCH In review Dotan Barak 2 participants 2 messages Apr 24, 2012 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rping: security fix: replace sprintf with snprintf

Replace sprintf with snprintf to protects from buffer overflow.

---
 examples/rping.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
examples/rping.c +1 -1
index ee292ec..785338e 100644
@@ -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++;
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 201204241438.28483.dotanb-g2bIKuvJtcQanlnWow0HJg@public.gmane.org