aboutsummaryrefslogtreecommitdiffstats
path: root/erts/etc/common/inet_gethost.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-09-25 18:01:23 +0200
committerBjörn-Egil Dahlberg <[email protected]>2012-09-25 18:01:23 +0200
commitd6089c81ce6d3184738be4f936e2cbd5008e077f (patch)
tree25a3a84235e7f43dfaf4bf33a2c506a249abe97d /erts/etc/common/inet_gethost.c
parentec28e2668b2e45d70efeb0005dcb2a70766cc7cb (diff)
parent32286d6523d0f46163f1c5e23253516d61c46c78 (diff)
downloadotp-d6089c81ce6d3184738be4f936e2cbd5008e077f.tar.gz
otp-d6089c81ce6d3184738be4f936e2cbd5008e077f.tar.bz2
otp-d6089c81ce6d3184738be4f936e2cbd5008e077f.zip
Merge branch 'egil/r16/strengthen-buffer-copies'
* egil/r16/strengthen-buffer-copies: Replace sprintf with erts_snprintf in beam Replace sprintf with erts_snprintf in epmd Replace sprintf with erts_snprintf in inet_gethost
Diffstat (limited to 'erts/etc/common/inet_gethost.c')
-rw-r--r--erts/etc/common/inet_gethost.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/erts/etc/common/inet_gethost.c b/erts/etc/common/inet_gethost.c
index e923233ce9..b9a0e6bde3 100644
--- a/erts/etc/common/inet_gethost.c
+++ b/erts/etc/common/inet_gethost.c
@@ -2522,7 +2522,7 @@ static char *format_address(int siz, AddrByte *addr)
*buff='\0';
if (siz <= 4) {
while(siz--) {
- sprintf(tmp,"%d",(int) *addr++);
+ erts_snprintf(tmp, sizeof(tmp), "%d",(int) *addr++);
strcat(buff,tmp);
if(siz) {
strcat(buff,".");
@@ -2531,7 +2531,7 @@ static char *format_address(int siz, AddrByte *addr)
return buff;
}
while(siz--) {
- sprintf(tmp,"%02x",(int) *addr++);
+ erts_snprintf(tmp, sizeof(tmp), "%02x",(int) *addr++);
strcat(buff,tmp);
if(siz) {
strcat(buff,":");
@@ -2548,9 +2548,9 @@ static void debugf(char *format, ...)
va_start(ap,format);
#ifdef WIN32
- sprintf(buff,"%s[%d] (DEBUG):",program_name,(int) GetCurrentThreadId());
+ erts_snprintf(buff, sizeof(buff), "%s[%d] (DEBUG):",program_name,(int) GetCurrentThreadId());
#else
- sprintf(buff,"%s[%d] (DEBUG):",program_name,(int) getpid());
+ erts_snprintf(buff, sizeof(buff), "%s[%d] (DEBUG):",program_name,(int) getpid());
#endif
ptr = buff + strlen(buff);
erts_vsnprintf(ptr,sizeof(buff)-strlen(buff)-2,format,ap);
@@ -2574,7 +2574,7 @@ static void warning(char *format, ...)
va_list ap;
va_start(ap,format);
- sprintf(buff,"%s[%d]: WARNING:",program_name, (int) getpid());
+ erts_snprintf(buff, sizeof(buff), "%s[%d]: WARNING:",program_name, (int) getpid());
ptr = buff + strlen(buff);
erts_vsnprintf(ptr,sizeof(buff)-strlen(buff)-2,format,ap);
strcat(ptr,"\r\n");
@@ -2597,7 +2597,7 @@ static void fatal(char *format, ...)
va_list ap;
va_start(ap,format);
- sprintf(buff,"%s[%d]: FATAL ERROR:",program_name, (int) getpid());
+ erts_snprintf(buff, sizeof(buff), "%s[%d]: FATAL ERROR:",program_name, (int) getpid());
ptr = buff + strlen(buff);
erts_vsnprintf(ptr,sizeof(buff)-strlen(buff)-2,format,ap);
strcat(ptr,"\r\n");