Skip to content

Commit

Permalink
g.proj: Fix copy into fixed size buffer issue in input.c file (#4359)
Browse files Browse the repository at this point in the history
Co-authored-by: Shubham Vasudeo Desai <[email protected]>
  • Loading branch information
ShubhamDesai and Shubham Vasudeo Desai authored Sep 21, 2024
1 parent 2356520 commit d89ad9e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions general/g.proj/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,12 @@ int input_proj4(char *proj4params)
if (fgets(buff, sizeof(buff), infd) == NULL)
G_warning(_("Failed to read PROJ.4 parameter from stdin"));
}
else
strcpy(buff, proj4params);
else {
if (G_strlcpy(buff, proj4params, sizeof(buff)) >= sizeof(buff)) {
G_fatal_error(_("PROJ.4 parameter string is too long: %s"),
proj4params);
}
}

#if PROJ_VERSION_MAJOR >= 6
if (!strstr(buff, "+type=crs"))
Expand Down

0 comments on commit d89ad9e

Please sign in to comment.