Skip to content

Commit

Permalink
Fix some gcc 8.1 snprintf overflow warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Jun 1, 2018
1 parent e252fb5 commit 6eb178f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions hwloc/topology-linux.c
Expand Up @@ -4880,7 +4880,7 @@ hwloc_linuxfs_block_class_fillinfos(struct hwloc_backend *backend __hwloc_attrib
struct hwloc_linux_backend_data_s *data = backend->private_data;
#endif
FILE *file;
char path[256];
char path[296]; /* osdevpath <= 256 */
char line[128];
char vendor[64] = "";
char model[64] = "";
Expand Down Expand Up @@ -5093,7 +5093,7 @@ hwloc_linuxfs_net_class_fillinfos(int root_fd,
struct hwloc_obj *obj, const char *osdevpath)
{
struct stat st;
char path[256];
char path[296]; /* osdevpath <= 256 */
char address[128];
snprintf(path, sizeof(path), "%s/address", osdevpath);
if (!hwloc_read_path_by_length(path, address, sizeof(address), root_fd)) {
Expand Down Expand Up @@ -5160,7 +5160,7 @@ static void
hwloc_linuxfs_infiniband_class_fillinfos(int root_fd,
struct hwloc_obj *obj, const char *osdevpath)
{
char path[256];
char path[296]; /* osdevpath <= 256 */
char guidvalue[20];
unsigned i,j;

Expand Down Expand Up @@ -5281,7 +5281,7 @@ static void
hwloc_linuxfs_mic_class_fillinfos(int root_fd,
struct hwloc_obj *obj, const char *osdevpath)
{
char path[256];
char path[296]; /* osdevpath <= 256 */
char family[64];
char sku[64];
char sn[64];
Expand Down
2 changes: 1 addition & 1 deletion hwloc/topology.c
Expand Up @@ -1392,7 +1392,7 @@ hwloc___insert_object_by_cpuset(struct hwloc_topology *topology, hwloc_obj_t cur
if (report_error) {
char childstr[512];
char objstr[512];
char msg[1024];
char msg[1100];
hwloc__report_error_format_obj(objstr, sizeof(objstr), obj);
hwloc__report_error_format_obj(childstr, sizeof(childstr), child);
snprintf(msg, sizeof(msg), "%s intersects with %s without inclusion!", objstr, childstr);
Expand Down
2 changes: 1 addition & 1 deletion utils/lstopo/lstopo-draw.c
Expand Up @@ -1206,7 +1206,7 @@ output_draw(struct lstopo_output *loutput)
time_t t;
char text[3][128];
unsigned ntext = 0;
char hostname[128] = "";
char hostname[122] = "";
const char *forcedhostname = NULL;
unsigned long hostname_size = sizeof(hostname);
unsigned maxtextwidth = 0, textwidth;
Expand Down

0 comments on commit 6eb178f

Please sign in to comment.