alfred: Remove manual \0 terminator after snprintf
PATCH 1/1 alfred: Remove manual \0 terminator after snprintf
snprintf already guarantees \0 terminated strings for size arguments is > 0.
Reported-by Anatoliy Lapitskiy <[email protected]>
Signed-off-by Sven Eckelmann <[email protected]>
--- debugfs.c | 1 - vis/vis.c | 3 --- 2 files changed, 4 deletions(-)
debugfs.c +0 -1
@@ -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 ; }
vis/vis.c +0 -3
@@ -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 ;
Signature · 1 line
2.1.4
Simon Wunderlich
AppliedQuoted 4 lines · 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 <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>
Applied in revision f7914a8.
Thanks!
Simon