* [B.A.T.M.A.N.] [PATCH] alfred: Remove manual \0 terminator after snprintf
@ 2015-03-17 7:47 Sven Eckelmann
2015-03-19 17:21 ` Simon Wunderlich
0 siblings, 1 reply; 2+ messages in thread
From: Sven Eckelmann @ 2015-03-17 7:47 UTC (permalink / raw)
To: b.a.t.m.a.n; +Cc: Sven Eckelmann
snprintf already guarantees \0 terminated strings for size arguments is > 0.
Reported-by: Anatoliy Lapitskiy <anatoliy.lapitskiy@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
debugfs.c | 1 -
vis/vis.c | 3 ---
2 files changed, 4 deletions(-)
diff --git a/debugfs.c b/debugfs.c
index fbf992e..6404b49 100644
--- a/debugfs.c
+++ b/debugfs.c
@@ -58,7 +58,6 @@ int debugfs_make_path(const char *fmt, const char *mesh_iface, char *buffer,
return len+1;
snprintf(buffer, size-1, fmt, debugfs_mountpoint, mesh_iface);
- buffer[size - 1] = '\0';
return 0;
}
diff --git a/vis/vis.c b/vis/vis.c
index 4a14e66..c1f8dad 100644
--- a/vis/vis.c
+++ b/vis/vis.c
@@ -274,7 +274,6 @@ static int register_interfaces(struct globals *globals)
while ((iface_dir = readdir(iface_base_dir)) != NULL) {
snprintf(path_buff, PATH_BUFF_LEN, SYS_MESH_IFACE_FMT, iface_dir->d_name);
- path_buff[PATH_BUFF_LEN - 1] = '\0';
file_content = read_file(path_buff);
if (!file_content)
continue;
@@ -292,7 +291,6 @@ static int register_interfaces(struct globals *globals)
file_content = NULL;
snprintf(path_buff, PATH_BUFF_LEN, SYS_IFACE_STATUS_FMT, iface_dir->d_name);
- path_buff[PATH_BUFF_LEN - 1] = '\0';
file_content = read_file(path_buff);
if (!file_content)
continue;
@@ -328,7 +326,6 @@ static int parse_orig_list(struct globals *globals)
struct vis_list_entry *v_entry;
snprintf(path, sizeof(path), "/sys/kernel/debug/batman_adv/%s/originators", globals->interface);
- path[sizeof(path) - 1] = 0;
fbuf = read_file(path);
if (!fbuf)
return -1;
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH] alfred: Remove manual \0 terminator after snprintf
2015-03-17 7:47 [B.A.T.M.A.N.] [PATCH] alfred: Remove manual \0 terminator after snprintf Sven Eckelmann
@ 2015-03-19 17:21 ` Simon Wunderlich
0 siblings, 0 replies; 2+ messages in thread
From: Simon Wunderlich @ 2015-03-19 17:21 UTC (permalink / raw)
To: b.a.t.m.a.n
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
On Tuesday 17 March 2015 08:47:29 Sven Eckelmann wrote:
> snprintf already guarantees \0 terminated strings for size arguments is > 0.
>
> Reported-by: Anatoliy Lapitskiy <anatoliy.lapitskiy@gmail.com>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
Applied in revision f7914a8.
Thanks!
Simon
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-19 17:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17 7:47 [B.A.T.M.A.N.] [PATCH] alfred: Remove manual \0 terminator after snprintf Sven Eckelmann
2015-03-19 17:21 ` Simon Wunderlich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.