aboutsummaryrefslogtreecommitdiff
path: root/slirp/tftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'slirp/tftp.c')
-rw-r--r--slirp/tftp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/slirp/tftp.c b/slirp/tftp.c
index 1821648251..8055ccc17a 100644
--- a/slirp/tftp.c
+++ b/slirp/tftp.c
@@ -136,9 +136,9 @@ static int tftp_send_oack(struct tftp_session *spt,
m->m_data += sizeof(struct udpiphdr);
tp->tp_op = htons(TFTP_OACK);
- n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s",
+ n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%s",
key) + 1;
- n += snprintf((char *)tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u",
+ n += snprintf(tp->x.tp_buf + n, sizeof(tp->x.tp_buf) - n, "%u",
value) + 1;
saddr.sin_addr = recv_tp->ip.ip_dst;
@@ -283,7 +283,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
/* skip header fields */
k = 0;
- pktlen -= ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp);
+ pktlen -= offsetof(struct tftp_t, x.tp_buf);
/* prepend tftp_prefix */
prefix_len = strlen(slirp->tftp_prefix);
@@ -299,7 +299,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
tftp_send_error(spt, 2, "Access violation", tp);
return;
}
- req_fname[k] = (char)tp->x.tp_buf[k];
+ req_fname[k] = tp->x.tp_buf[k];
if (req_fname[k++] == '\0') {
break;
}
@@ -311,7 +311,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
return;
}
- if (strcasecmp((const char *)&tp->x.tp_buf[k], "octet") != 0) {
+ if (strcasecmp(&tp->x.tp_buf[k], "octet") != 0) {
tftp_send_error(spt, 4, "Unsupported transfer mode", tp);
return;
}
@@ -340,7 +340,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
while (k < pktlen) {
const char *key, *value;
- key = (const char *)&tp->x.tp_buf[k];
+ key = &tp->x.tp_buf[k];
k += strlen(key) + 1;
if (k >= pktlen) {
@@ -348,7 +348,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct tftp_t *tp, int pktlen)
return;
}
- value = (const char *)&tp->x.tp_buf[k];
+ value = &tp->x.tp_buf[k];
k += strlen(value) + 1;
if (strcasecmp(key, "tsize") == 0) {