From af90a105ec97c6d856d2e8a80e8822c3e192d1e9 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 9 May 2015 11:19:33 -0700 Subject: Replace remaining sprintf calls with snprintf Signed-off-by: Alan Coopersmith --- geometry.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'geometry.c') diff --git a/geometry.c b/geometry.c index 8f3adea..0bc9445 100644 --- a/geometry.c +++ b/geometry.c @@ -63,7 +63,7 @@ _FindWidget(Widget w) Window win; int x, y; /* location of event in root coordinates. */ - sprintf(msg, res_labels[14]); + snprintf(msg, sizeof(msg), res_labels[14]); SetMessage(global_screen_data.info_label, msg); @@ -103,7 +103,7 @@ DisplayChild(Event *event) find_event->widgets.num_widgets); if (node == NULL) { - sprintf(msg, res_labels[13]); + snprintf(msg, sizeof(msg), res_labels[13]); SetMessage(global_screen_data.info_label, msg); return; } @@ -112,7 +112,7 @@ DisplayChild(Event *event) node = node->tree_info->top_node; - sprintf(msg, res_labels[12], node->name, node->class); + snprintf(msg, sizeof(msg), res_labels[12], node->name, node->class); SetMessage(global_screen_data.info_label, msg); _FlashActiveWidgets(global_tree_info); @@ -193,7 +193,8 @@ AddToFlashList(TreeInfo *tree_info, GetGeomInfo *geom_info, char **errors) geom_info->widgets.ids, geom_info->widgets.num_widgets); if (node == NULL) { - sprintf(buf, "Editres Internal Error: Unable to FindNode.\n"); + snprintf(buf, sizeof(buf), + "Editres Internal Error: Unable to FindNode.\n"); AddString(errors, buf); return; } @@ -204,7 +205,7 @@ AddToFlashList(TreeInfo *tree_info, GetGeomInfo *geom_info, char **errors) } if (!geom_info->visable) { - sprintf(buf, "%s(0x%lx) - This widget is not mapped\n", + snprintf(buf, sizeof(buf), "%s(0x%lx) - This widget is not mapped\n", node->name, node->id); AddString(errors, buf); return; @@ -240,11 +241,13 @@ _AddToFlashList(TreeInfo *tree_info, char **errors, WNode *node, char buf[BUFSIZ]; if (node->window == EDITRES_IS_OBJECT) - sprintf(buf, "%s(0x%lx) - This object's parent is unrealized\n", - node->name, node->id); + snprintf(buf, sizeof(buf), + "%s(0x%lx) - This object's parent is unrealized\n", + node->name, node->id); else - sprintf(buf, "%s(0x%lx) - This widget is unrealized\n", - node->name, node->id); + snprintf(buf, sizeof(buf), + "%s(0x%lx) - This widget is unrealized\n", + node->name, node->id); AddString(errors, buf); return; @@ -261,8 +264,9 @@ _AddToFlashList(TreeInfo *tree_info, char **errors, WNode *node, if (global_error_code == NO_WINDOW) { char buf[BUFSIZ]; - sprintf(buf, "%s(0x%lx) - This widget's window no longer exists.\n", - node->name, node->id); + snprintf(buf, sizeof(buf), + "%s(0x%lx) - This widget's window no longer exists.\n", + node->name, node->id); AddString(errors, buf); return; } @@ -270,8 +274,8 @@ _AddToFlashList(TreeInfo *tree_info, char **errors, WNode *node, if (attrs.map_state != IsViewable) { char buf[BUFSIZ]; - sprintf(buf, "%s(0x%lx) - This widget is not mapped.\n", - node->name, node->id); + snprintf(buf, sizeof(buf), "%s(0x%lx) - This widget is not mapped.\n", + node->name, node->id); AddString(errors, buf); return; } -- cgit v1.2.3