Use bsprintf() instead of sprintf().
This commit is contained in:
parent
221135d6bf
commit
a37410cbdd
5 changed files with 13 additions and 12 deletions
1
TODO
1
TODO
|
@ -36,6 +36,7 @@ Globals
|
||||||
- protocols: implement CLI hooks and per-procotol CLI commands
|
- protocols: implement CLI hooks and per-procotol CLI commands
|
||||||
- protocols: implement reconfigure hook
|
- protocols: implement reconfigure hook
|
||||||
- protocols: use locking
|
- protocols: use locking
|
||||||
|
- check use of system includes and sprintf()
|
||||||
|
|
||||||
Various ideas
|
Various ideas
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
16
lib/ipv6.c
16
lib/ipv6.c
|
@ -167,12 +167,12 @@ ip_ntop(ip_addr a, char *b)
|
||||||
bestlen == 6))
|
bestlen == 6))
|
||||||
{
|
{
|
||||||
u32 x = a.addr[3];
|
u32 x = a.addr[3];
|
||||||
b += sprintf(b, "::%s%d.%d.%d.%d",
|
b += bsprintf(b, "::%s%d.%d.%d.%d",
|
||||||
a.addr[2] ? "ffff:" : "",
|
a.addr[2] ? "ffff:" : "",
|
||||||
((x >> 24) & 0xff),
|
((x >> 24) & 0xff),
|
||||||
((x >> 16) & 0xff),
|
((x >> 16) & 0xff),
|
||||||
((x >> 8) & 0xff),
|
((x >> 8) & 0xff),
|
||||||
(x & 0xff));
|
(x & 0xff));
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ ip_ntop(ip_addr a, char *b)
|
||||||
{
|
{
|
||||||
if (i)
|
if (i)
|
||||||
*b++ = ':';
|
*b++ = ':';
|
||||||
b += sprintf(b, "%x", words[i]);
|
b += bsprintf(b, "%x", words[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*b = 0;
|
*b = 0;
|
||||||
|
@ -206,7 +206,7 @@ ip_ntox(ip_addr a, char *b)
|
||||||
{
|
{
|
||||||
if (i)
|
if (i)
|
||||||
*b++ = '.';
|
*b++ = '.';
|
||||||
b += sprintf(b, "%08x", a.addr[i]);
|
b += bsprintf(b, "%08x", a.addr[i]);
|
||||||
}
|
}
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ rdump(void *res)
|
||||||
char x[16];
|
char x[16];
|
||||||
resource *r = res;
|
resource *r = res;
|
||||||
|
|
||||||
sprintf(x, "%%%ds%%08x ", indent);
|
bsprintf(x, "%%%ds%%08x ", indent);
|
||||||
debug(x, "", (int) r);
|
debug(x, "", (int) r);
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
|
|
|
@ -504,8 +504,8 @@ rip_dump(struct proto *p)
|
||||||
static void
|
static void
|
||||||
rip_get_route_info(rte *rte, byte *buf)
|
rip_get_route_info(rte *rte, byte *buf)
|
||||||
{
|
{
|
||||||
buf += sprintf(buf, " (%d/%d)", rte->pref, rte->u.rip.metric );
|
buf += bsprintf(buf, " (%d/%d)", rte->pref, rte->u.rip.metric );
|
||||||
sprintf(buf, " t%04x", rte->u.rip.tag );
|
bsprintf(buf, " t%04x", rte->u.rip.tag );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -288,7 +288,7 @@ tm_format_date(char *x, bird_clock_t t)
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
|
|
||||||
tm = localtime(&t);
|
tm = localtime(&t);
|
||||||
sprintf(x, "%02d-%02d-%04d", tm->tm_mday, tm->tm_mon+1, tm->tm_year+1900);
|
bsprintf(x, "%02d-%02d-%04d", tm->tm_mday, tm->tm_mon+1, tm->tm_year+1900);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue