Loading slirp/slirp.c +2 −2 Original line number Diff line number Diff line Loading @@ -320,7 +320,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, slirp->vprefix_len = vprefix_len; slirp->vhost_addr6 = vhost6; if (vhostname) { pstrcpy(slirp->client_hostname, sizeof(slirp->client_hostname), slirp_pstrcpy(slirp->client_hostname, sizeof(slirp->client_hostname), vhostname); } slirp->tftp_prefix = g_strdup(tftp_path); Loading slirp/tftp.c +1 −1 Original line number Diff line number Diff line Loading @@ -216,7 +216,7 @@ static void tftp_send_error(struct tftp_session *spt, tp->tp_op = htons(TFTP_ERROR); tp->x.tp_error.tp_error_code = htons(errorcode); pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg); slirp_pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg); m->m_len = sizeof(struct tftp_t) - (TFTP_BLOCKSIZE_MAX + 2) + 3 + strlen(msg) - sizeof(struct udphdr); Loading slirp/util.c +17 −0 Original line number Diff line number Diff line Loading @@ -188,3 +188,20 @@ int slirp_closesocket(int fd) return ret; } #endif /* WIN32 */ void slirp_pstrcpy(char *buf, int buf_size, const char *str) { int c; char *q = buf; if (buf_size <= 0) return; for(;;) { c = *str++; if (c == 0 || q >= buf + buf_size - 1) break; *q++ = c; } *q = '\0'; } slirp/util.h +2 −0 Original line number Diff line number Diff line Loading @@ -91,4 +91,6 @@ static inline int slirp_socket_set_fast_reuse(int fd) #endif } void slirp_pstrcpy(char *buf, int buf_size, const char *str); #endif Loading
slirp/slirp.c +2 −2 Original line number Diff line number Diff line Loading @@ -320,7 +320,7 @@ Slirp *slirp_init(int restricted, bool in_enabled, struct in_addr vnetwork, slirp->vprefix_len = vprefix_len; slirp->vhost_addr6 = vhost6; if (vhostname) { pstrcpy(slirp->client_hostname, sizeof(slirp->client_hostname), slirp_pstrcpy(slirp->client_hostname, sizeof(slirp->client_hostname), vhostname); } slirp->tftp_prefix = g_strdup(tftp_path); Loading
slirp/tftp.c +1 −1 Original line number Diff line number Diff line Loading @@ -216,7 +216,7 @@ static void tftp_send_error(struct tftp_session *spt, tp->tp_op = htons(TFTP_ERROR); tp->x.tp_error.tp_error_code = htons(errorcode); pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg); slirp_pstrcpy((char *)tp->x.tp_error.tp_msg, sizeof(tp->x.tp_error.tp_msg), msg); m->m_len = sizeof(struct tftp_t) - (TFTP_BLOCKSIZE_MAX + 2) + 3 + strlen(msg) - sizeof(struct udphdr); Loading
slirp/util.c +17 −0 Original line number Diff line number Diff line Loading @@ -188,3 +188,20 @@ int slirp_closesocket(int fd) return ret; } #endif /* WIN32 */ void slirp_pstrcpy(char *buf, int buf_size, const char *str) { int c; char *q = buf; if (buf_size <= 0) return; for(;;) { c = *str++; if (c == 0 || q >= buf + buf_size - 1) break; *q++ = c; } *q = '\0'; }
slirp/util.h +2 −0 Original line number Diff line number Diff line Loading @@ -91,4 +91,6 @@ static inline int slirp_socket_set_fast_reuse(int fd) #endif } void slirp_pstrcpy(char *buf, int buf_size, const char *str); #endif