<feed xmlns='http://www.w3.org/2005/Atom'>
<title>xavi/slcl/main.c, branch v0.2.1-rc2</title>
<subtitle>Small and lightweight cloud storage written in C99 and POSIX.1-2008.
</subtitle>
<id>https://gitea.privatedns.org/xavi/slcl/atom?h=v0.2.1-rc2</id>
<link rel='self' href='https://gitea.privatedns.org/xavi/slcl/atom?h=v0.2.1-rc2'/>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/'/>
<updated>2024-02-19T23:17:40+00:00</updated>
<entry>
<title>main.c: Force valid cookie on check_length</title>
<updated>2024-02-19T23:17:40+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-02-19T23:17:40+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=b7f232366c03dad8afbbb8ed5ba44314e42b13fd'/>
<id>urn:sha1:b7f232366c03dad8afbbb8ed5ba44314e42b13fd</id>
<content type='text'>
Otherwise, a malicious user could send multipart/form-data requests
without a valid cookie.
</content>
</entry>
<entry>
<title>main.c: const-qualify name and dir</title>
<updated>2024-02-19T22:35:08+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-02-19T22:08:35+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=55008f2f648b2ebb275d04607961d6bd4b9768ec'/>
<id>urn:sha1:55008f2f648b2ebb275d04607961d6bd4b9768ec</id>
<content type='text'>
There was no reason why these should not be const-qualified. It was
probably missed during the implementation.
</content>
</entry>
<entry>
<title>main.c: URL-encode created directories</title>
<updated>2024-02-19T22:35:08+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-02-19T22:07:16+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=1f8aa578a489905ed2d7443cfcdb73a3ff8d48ea'/>
<id>urn:sha1:1f8aa578a489905ed2d7443cfcdb73a3ff8d48ea</id>
<content type='text'>
Otherwise, directories with special characters, such as "%", would not
be accessible when performing the redirection.
</content>
</entry>
<entry>
<title>main.c: Use fstat(2) on move_file</title>
<updated>2024-02-19T22:35:08+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-02-19T22:04:50+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=a578ad6537320e562ce936bf70426ab2820ddaad'/>
<id>urn:sha1:a578ad6537320e562ce936bf70426ab2820ddaad</id>
<content type='text'>
This allows to reuse the same file descriptor to both open(2) and
fstat(2) the file.
</content>
</entry>
<entry>
<title>Bump libweb to 0.3.0</title>
<updated>2024-02-19T22:35:08+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-02-19T22:03:16+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=f6b84b765d6fa4d95aae5501fedca5cd8903e224'/>
<id>urn:sha1:f6b84b765d6fa4d95aae5501fedca5cd8903e224</id>
<content type='text'>
The following commits fix a couple of security issues on libweb.

Because of afe0681c0b26bb64bad55d7e86770f346cfa043e, slcl had to be
updated to set up its struct http_cfg_post.

commit afe0681c0b26bb64bad55d7e86770f346cfa043e
Author: Xavier Del Campo Romero &lt;xavi.dcr@tutanota.com&gt;
Date:   Mon Feb 19 23:00:56 2024 +0100

    Limit maximum multipart/form-data pairs and files

    A malicious user could inject an infinite number of empty files or
    key/value pairs into a request in order to exhaust the device's
    resources.

commit 9d9e0c2979f43297b2ebbf84f14f064f3f9ced0e
Author: Xavier Del Campo Romero &lt;xavi.dcr@tutanota.com&gt;
Date:   Mon Feb 19 22:49:09 2024 +0100

    html.c: Avoid half-init objects on html_node_add_attr

    The previous implementation would leave half-initialised objects if one
    of the calls to strdup(3) failed. Now, n-&gt;attrs is only modified when
    all previous memory allocations were successful.
</content>
</entry>
<entry>
<title>main.c: Add missing relative path check</title>
<updated>2024-02-19T15:59:54+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2024-02-19T15:59:22+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=0f889b409e20aea188e88b79b73ded992fc6af33'/>
<id>urn:sha1:0f889b409e20aea188e88b79b73ded992fc6af33</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Upgrade to new libweb interface</title>
<updated>2023-11-22T23:06:09+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-22T23:04:28+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=1768210ea43a1a692f844f7497940ec7d3f28d3c'/>
<id>urn:sha1:1768210ea43a1a692f844f7497940ec7d3f28d3c</id>
<content type='text'>
Recent commits from libweb brought a few breaking changes. The one below
affected slcl, so it had to be updated according to the new interface:

commit 98f5f52461b0c1ab1ee3331722bd32e2db9e1d41
Author: Xavier Del Campo &lt;xavier.delcampo@midokura.com&gt;
Date:   Thu Nov 16 12:23:08 2023 +0100

    Split handler_loop from handler_listen

    Some applications might set up a struct handler object to listen on any
    port i.e., 0, but still need a way to determine which port number was
    eventually selected by the implementation.

    Therefore, handler_listen has been reduced to the server initialization
    bit, whereas the main loop has been split into its own function, namely
    handler_loop.

    Because of these changes, it no longer made sense for libweb to write
    the selected port to standard output, as this is something now
    applications can do on their own.
</content>
</entry>
<entry>
<title>main.c: Treat non-existing upload dir as non-fatal</title>
<updated>2023-11-22T23:01:41+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-22T23:01:41+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=daffea4660560f7420e57ecc40b29f6ef3c46f98'/>
<id>urn:sha1:daffea4660560f7420e57ecc40b29f6ef3c46f98</id>
<content type='text'>
When a user attempts to upload a file into a non-existing directory,
slcl would not check whether the directory exists. Then, rename(3) would
fail and slcl would treat this as a fatal error, effectively closing
itself.

Since this is an example of ill-formed user input, it must be treated as
a non-fatal error, and instead slcl should return a bad request page.
</content>
</entry>
<entry>
<title>libweb: Bump new signature for http_decode_url</title>
<updated>2023-11-12T00:30:43+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-11-11T23:01:35+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=8dff21942ef7815d04eb03b822ab49d1c8651ad4'/>
<id>urn:sha1:8dff21942ef7815d04eb03b822ab49d1c8651ad4</id>
<content type='text'>
The new signature allows callers to distinguish decoding errors from
fatal errors. This is important for slcl to avoid crashing when
ill-formed data is received from a client.
</content>
</entry>
<entry>
<title>main.c: Use BUFSIZ instead of arbitrary value</title>
<updated>2023-10-19T13:32:22+00:00</updated>
<author>
<name>Xavier Del Campo Romero</name>
<email>xavi.dcr@tutanota.com</email>
</author>
<published>2023-10-19T13:32:22+00:00</published>
<link rel='alternate' type='text/html' href='https://gitea.privatedns.org/xavi/slcl/commit/?id=9376361bcb8e323c7041d19895f967b5bf3ba038'/>
<id>urn:sha1:9376361bcb8e323c7041d19895f967b5bf3ba038</id>
<content type='text'>
According to C99 7.19.1p3:

BUFSIZ is a macro that expands to an integer constant expression that is
the size of the buffer used by the setbuf function.

In other words, this means BUFSIZ is the most optimal length for a
buffer that reads a file into memory in chunks using fread(3).
</content>
</entry>
</feed>
