Skip to content

Commit

Permalink
Replace sprintf with erts_snprintf in epmd
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeugenic committed Sep 7, 2012
1 parent 0c66526 commit 7bd6951
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion erts/epmd/src/epmd.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int epmd_dbg(int level,int port) /* Utility to debug epmd... */
if(port) if(port)
{ {
argv[argc++] = "-port"; argv[argc++] = "-port";
sprintf(ibuff,"%d",port); erts_snprintf(ibuff, sizeof(ibuff), "%d",port);
argv[argc++] = ibuff; argv[argc++] = ibuff;
} }
argv[argc] = NULL; argv[argc] = NULL;
Expand Down
7 changes: 4 additions & 3 deletions erts/epmd/src/epmd_srv.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#endif #endif
#include "epmd.h" /* Renamed from 'epmd_r4.h' */ #include "epmd.h" /* Renamed from 'epmd_r4.h' */
#include "epmd_int.h" #include "epmd_int.h"
#include "erl_printf.h" /* erts_snprintf */


#ifndef INADDR_NONE #ifndef INADDR_NONE
# define INADDR_NONE 0xffffffff # define INADDR_NONE 0xffffffff
Expand Down Expand Up @@ -633,7 +634,7 @@ static void do_request(g, fd, s, buf, bsize)
/* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight /* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight
change in syntax will break < OTP R3A */ change in syntax will break < OTP R3A */


sprintf(wbuf,"name %s at port %d\n",node->symname, node->port); erts_snprintf(wbuf, sizeof(wbuf), "name %s at port %d\n",node->symname, node->port);
len = strlen(wbuf); len = strlen(wbuf);
if (reply(g, fd, wbuf, len) != len) if (reply(g, fd, wbuf, len) != len)
{ {
Expand Down Expand Up @@ -669,7 +670,7 @@ static void do_request(g, fd, s, buf, bsize)
/* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight /* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight
change in syntax will break < OTP R3A */ change in syntax will break < OTP R3A */


sprintf(wbuf,"active name <%s> at port %d, fd = %d\n", erts_snprintf(wbuf, sizeof(wbuf), "active name <%s> at port %d, fd = %d\n",
node->symname, node->port, node->fd); node->symname, node->port, node->fd);
len = strlen(wbuf) + 1; len = strlen(wbuf) + 1;
if (reply(g, fd,wbuf,len) != len) if (reply(g, fd,wbuf,len) != len)
Expand All @@ -686,7 +687,7 @@ static void do_request(g, fd, s, buf, bsize)
/* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight /* CAREFUL!!! These are parsed by "erl_epmd.erl" so a slight
change in syntax will break < OTP R3A */ change in syntax will break < OTP R3A */


sprintf(wbuf,"old/unused name <%s>, port = %d, fd = %d \n", erts_snprintf(wbuf, sizeof(wbuf), "old/unused name <%s>, port = %d, fd = %d \n",
node->symname,node->port, node->fd); node->symname,node->port, node->fd);
len = strlen(wbuf) + 1; len = strlen(wbuf) + 1;
if (reply(g, fd,wbuf,len) != len) if (reply(g, fd,wbuf,len) != len)
Expand Down

0 comments on commit 7bd6951

Please sign in to comment.