summaryrefslogtreecommitdiff
path: root/slirp/tftp.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-21 17:58:08 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-08-21 17:58:08 +0000
commit363a37d52016e0a16e3599d690f610346fc6898a (patch)
tree35ce1129736b9c6833c2e5eda5c6015b7897c67f /slirp/tftp.c
parentc93e7817ee963d9441f6706d6f194ff02cec690f (diff)
Fix OpenBSD linker warnings
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5044 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'slirp/tftp.c')
-rw-r--r--slirp/tftp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/slirp/tftp.c b/slirp/tftp.c
index 562ae8953d..8c0126866a 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -23,6 +23,7 @@
*/
#include <slirp.h>
+#include "qemu-common.h" // for pstrcpy
struct tftp_session {
int in_use;
@@ -148,8 +149,8 @@ static int tftp_send_oack(struct tftp_session *spt,
m->m_data += sizeof(struct udpiphdr);
tp->tp_op = htons(TFTP_OACK);
- n += sprintf(tp->x.tp_buf + n, "%s", key) + 1;
- n += sprintf(tp->x.tp_buf + n, "%u", value) + 1;
+ n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s", key) + 1;
+ n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u", value) + 1;
saddr.sin_addr = recv_tp->ip.ip_dst;
saddr.sin_port = recv_tp->udp.uh_dport;
@@ -189,7 +190,7 @@ static int tftp_send_error(struct tftp_session *spt,
tp->tp_op = htons(TFTP_ERROR);
tp->x.tp_error.tp_error_code = htons(errorcode);
- strcpy(tp->x.tp_error.tp_msg, msg);
+ pstrcpy(tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg);
saddr.sin_addr = recv_tp->ip.ip_dst;
saddr.sin_port = recv_tp->udp.uh_dport;