From 3bb917da2e44f36a5fec32d735cb61839fe1cc6c Mon Sep 17 00:00:00 2001 From: calvin2021y <85545400+calvin2021y@users.noreply.github.com> Date: Fri, 4 Aug 2023 10:31:51 +0800 Subject: [PATCH] #1617 fix warning: 'sprintf' is deprecated from macOS (#1630) --- src/AsyncSocket.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AsyncSocket.h b/src/AsyncSocket.h index 7a9360817..6770974da 100644 --- a/src/AsyncSocket.h +++ b/src/AsyncSocket.h @@ -212,9 +212,9 @@ struct AsyncSocket { unsigned char *b = (unsigned char *) binary.data(); if (binary.length() == 4) { - ipLength = sprintf(buf, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]); + ipLength = snprintf(buf, 64, "%u.%u.%u.%u", b[0], b[1], b[2], b[3]); } else { - ipLength = sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", + ipLength = snprintf(buf, 64, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]); }