From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org,
Marek Lindner <mareklindner@neomailbox.ch>
Subject: Re: [PATCH 4/4] alfred: introduce 'server status' IPC call
Date: Sun, 02 Jan 2022 15:43:37 +0100 [thread overview]
Message-ID: <3214693.Z0pQRKLR2l@sven-l14> (raw)
In-Reply-To: <20220102113136.470299-4-mareklindner@neomailbox.ch>
[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]
On Sunday, 2 January 2022 12:31:36 CET Marek Lindner wrote:
> + list_for_each_entry(interface, &globals->interfaces, list) {
> + strncpy(status_rep->ifaces[iface_count].name,
> + interface->interface,
> + sizeof(status_rep->ifaces[iface_count].name));
> +
> + iface_count++;
> + }
> +
> + strncpy(status_rep->bat_iface, globals->mesh_iface,
> + sizeof(status_rep->bat_iface));
strncpy doesn't guarantee that the copied string ends with a \0. You have to
take care of that yourself.
This might not be a big problem here because the name buffers in the
interfaces list have currently the same size as the name buffers in
status_rep. Still feels better to have the line to manually set \0 at
the end of the buffer.
Another thing I've just noticed: You don't take care of initialization all the
bytes in the returned buffer. So you might leak data from the alfred process's
stack to the client.
@Simon, would you prefer to have a global "status" message (which cannot be
extended in the future) or separate "GET" queries for the existing commands:
* ALFRED_MODESWITCH -> ALFRED_GET_MODE
* ALFRED_CHANGE_INTERFACE -> ALFRED_GET_INTERFACES
* ALFRED_CHANGE_BAT_IFACE -> ALFRED_GET_BAT_IFACE
Kind regards,
Sven
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-01-02 14:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-02 11:30 alfred: runtime configuration Marek Lindner
2022-01-02 11:31 ` [PATCH 1/4] alfred: remove meaningless printf() call Marek Lindner
2022-01-02 11:31 ` [PATCH 2/4] alfred: Allow operating without any interface specified Marek Lindner
2022-01-02 14:20 ` Sven Eckelmann
2022-01-02 19:01 ` Marek Lindner
2022-01-03 8:54 ` Sven Eckelmann
2022-01-02 11:31 ` [PATCH 3/4] alfred: introduce 'change batman-adv interface' IPC call Marek Lindner
2022-01-02 11:31 ` [PATCH 4/4] alfred: introduce 'server status' " Marek Lindner
2022-01-02 14:43 ` Sven Eckelmann [this message]
2022-01-12 21:14 ` Marek Lindner
2022-01-20 8:25 ` Sven Eckelmann
2022-01-03 9:09 ` Sven Eckelmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3214693.Z0pQRKLR2l@sven-l14 \
--to=sven@narfation.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=mareklindner@neomailbox.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).