Selaa lähdekoodia

avoid buffer overflow

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@50185 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 13 vuotta sitten
vanhempi
commit
63d4934903
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      raster/r.support/main.c

+ 1 - 1
raster/r.support/main.c

@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
 
     if (title_opt->answer) {
 	strncpy(title, title_opt->answer, MAX_TITLE_LEN);
-	title[MAX_TITLE_LEN] = '\0';	/* strncpy doesn't null terminate oversized input */
+	title[MAX_TITLE_LEN - 1] = '\0';	/* strncpy doesn't null terminate oversized input */
 	G_strip(title);
 	G_debug(3, "map title= [%s]  (%d chars)", title, strlen(title));
 	Rast_put_cell_title(raster->answer, title);