aboutsummaryrefslogtreecommitdiff
path: root/src/sbuf.c
AgeCommit message (Collapse)AuthorFilesLines
2020-12-04Remove some needless (void)castsMarc-André Lureau1-1/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-22sbuf: simplify sbreserve()Marc-André Lureau1-13/+3
realloc/g_realloc() allocates memory if given ptr is NULL. Note: This changes a bit the code, since now sb_cc is always reset to 0, even if old and new value are the same. This seems more coherent, but may have weird side-effects if code relies on it. Reviewing usage of sbreserve() reveals that it is used before the socket buffer receives any data, at tcp_input() socket creation time, and during tcp_mss() which is earlier in TCP socket state. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-22sbuf: use unsigned typesMarc-André Lureau1-4/+3
Negative values wouldn't make sense in those functions and could lead to weird results. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-21Replace remaining malloc/free user with glibMarc-André Lureau1-15/+6
glib mem functions are already used in various places. Let's not mix the two, and instead abort on OOM conditions. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-21sbuf: replace a comment with a runtime warningMarc-André Lureau1-4/+2
Let see if it happens, and drop it eventually some day. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-21sbuf: check more strictly sbcopy() bounds with offsetMarc-André Lureau1-1/+1
We shouldn't be reading undefined data, check that the data to read remains within sb_cc limit. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-21sbuf: remove unused and undefined sbcopy() pathMarc-André Lureau1-2/+3
The only sbcopy() caller is tcp_output(). There, len is constrained to be 0 <= len <= sb_cc. Let's add some assert to avoid potential undefined behaviour (the function didn't return the actual number of bytes copied). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-11-21Don't leak memory when reallocation fails.Jindrich Novy1-4/+7
Signed-off-by: Jindrich Novy <jnovy@redhat.com> [ Marc-André - modified to use a temporary variable ] Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2019-03-22slirp: remove reference to COPYRIGHT fileMarc-André Lureau1-3/+0
The slirp COPYRIGHT file is a BSD-3 license. Instead of referring to another project file, the SPDX license notice present in all source files states that unequivocally. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2019-03-22slirp: clarify license of slirp files using SPDX: implicit via COPYRIGHTMarc-André Lureau1-0/+1
Add SPDX license identifier to clarify the license of files with reference to BSD license from slirp COPYRIGHT file. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
2019-03-07slirp: move sources to src/ subdirectoryMarc-André Lureau1-0/+188
Prepare for making slirp/ a standalone project. Remove some useless includes while at it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212162524.31504-5-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>