Skip to content

Commit

Permalink
r.water.outlet: Fix Copy into buffer size issue (#4752)
Browse files Browse the repository at this point in the history
Fix Copy into buffer size issue
  • Loading branch information
ShubhamDesai authored Nov 28, 2024
1 parent 378834b commit ede9e99
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions raster/r.water.outlet/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,14 @@ int main(int argc, char *argv[])

G_get_window(&window);

strcpy(drain_name, opt.input->answer);
strcpy(basin_name, opt.output->answer);
if (G_strlcpy(drain_name, opt.input->answer, sizeof(drain_name)) >=
sizeof(drain_name)) {
G_fatal_error(_("Drain name <%s> is too long"), opt.input->answer);
}
if (G_strlcpy(basin_name, opt.output->answer, sizeof(basin_name)) >=
sizeof(basin_name)) {
G_fatal_error(_("Basin name <%s> is too long"), opt.output->answer);
}

if (!G_scan_easting(opt.coords->answers[0], &E, G_projection()))
G_fatal_error(_("Illegal east coordinate '%s'"),
Expand Down

0 comments on commit ede9e99

Please sign in to comment.