[Slirp] [PATCH 5/6] tcp_ctl: use slirp_fmt()
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Mon Jan 27 09:24:13 UTC 2020
From: Marc-André Lureau <marcandre.lureau at redhat.com>
Make it safer to OOB (sb_cc must not go out of sb_data), warn on
truncation, abort on error.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Reviewed-by: Samuel Thibault <samuel.thibault at ens-lyon.org>
---
src/tcp_subr.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/tcp_subr.c b/src/tcp_subr.c
index 7832b14..a699117 100644
--- a/src/tcp_subr.c
+++ b/src/tcp_subr.c
@@ -965,9 +965,8 @@ int tcp_ctl(struct socket *so)
}
}
}
- sb->sb_cc =
- snprintf(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
- "Error: No application configured.\r\n");
+ sb->sb_cc = slirp_fmt(sb->sb_wptr, sb->sb_datalen - (sb->sb_wptr - sb->sb_data),
+ "Error: No application configured.\r\n");
sb->sb_wptr += sb->sb_cc;
return 0;
}
--
2.25.0.rc2.1.g09a9a1a997
More information about the Slirp
mailing list