Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions imagery/i.ortho.photo/i.ortho.rectify/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,12 @@ int main(int argc, char *argv[])
interpolate = menu[method].method;

G_strip(grp->answer);
strcpy(group.name, grp->answer);
strcpy(extension, ext->answer);
if (G_strlcpy(group.name, grp->answer, sizeof(group.name)) >=
sizeof(group.name))
G_fatal_error(_("Group name <%s> is too long"), grp->answer);
if (G_strlcpy(extension, ext->answer, sizeof(extension)) >=
sizeof(extension))
G_fatal_error(_("Extension <%s> is too long"), ext->answer);

seg_mb = NULL;
if (mem->answer) {
Expand Down Expand Up @@ -281,7 +285,10 @@ int main(int argc, char *argv[])
if (!ref_list[i])
continue;

strcpy(result, group.group_ref.file[i].name);
if (G_strlcpy(result, group.group_ref.file[i].name,
sizeof(result)) >= sizeof(result))
G_fatal_error(_("Map name <%s> is too long"),
group.group_ref.file[i].name);
strcat(result, extension);

if (G_legal_filename(result) < 0)
Expand Down
10 changes: 6 additions & 4 deletions imagery/i.ortho.photo/i.ortho.rectify/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ int get_target(char *group)
snprintf(buf, sizeof(buf),
_("Mapset <%s> in target project (location) <%s> - "), mapset,
location);
strcat(buf, stat == 0 ? _("permission denied") : _("not found"));
(void)G_strlcat(buf, stat == 0 ? _("permission denied") : _("not found"),
sizeof(buf));
error:
strcat(buf, "\n");
strcat(buf, _("Please run i.target for group "));
strcat(buf, group);
(void)G_strlcat(buf, "\n", sizeof(buf));
(void)G_strlcat(buf, _("Please run i.target for group "), sizeof(buf));
if (G_strlcat(buf, group, sizeof(buf)) >= sizeof(buf))
G_fatal_error(_("Internal error: error message too long"));
G_fatal_error("%s", buf);
return 1; /* never reached */
}
Loading