Changed all sprintf() calls to snprintf() to make it useful for systems with very low buffer size

This commit is contained in:
adamdunkels 2008-02-24 20:59:51 +00:00
parent bd04cc1a32
commit 8906441004

View file

@ -28,7 +28,7 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: httpd-cgi.c,v 1.11 2008/02/17 13:59:22 oliverschmidt Exp $
* $Id: httpd-cgi.c,v 1.12 2008/02/24 20:59:51 adamdunkels Exp $
*
*/
@ -138,7 +138,7 @@ static unsigned short
generate_file_stats(void *arg)
{
char *f = (char *)arg;
return sprintf((char *)uip_appdata, "%5u", httpd_fs_count(f));
return snprintf((char *)uip_appdata, uip_mss(), "%5u", httpd_fs_count(f));
}
/*---------------------------------------------------------------------------*/
static
@ -158,7 +158,7 @@ make_tcp_stats(void *arg)
struct httpd_state *s = (struct httpd_state *)arg;
conn = &uip_conns[s->u.count];
return sprintf((char *)uip_appdata,
return snprintf((char *)uip_appdata, uip_mss(),
"<tr align=\"center\"><td>%d</td><td>%u.%u.%u.%u:%u</td><td>%s</td><td>%u</td><td>%u</td><td>%c %c</td></tr>\r\n",
htons(conn->lport),
conn->ripaddr.u8[0],
@ -196,7 +196,7 @@ make_processes(void *p)
strncpy(name, ((struct process *)p)->name, 40);
petsciiconv_toascii(name, 40);
return sprintf((char *)uip_appdata,
return snprintf((char *)uip_appdata, uip_mss(),
"<tr align=\"center\"><td>%p</td><td>%s</td><td>%p</td><td>%s</td></tr>\r\n",
p, name,
*((char **)&(((struct process *)p)->thread)),