Prevent buffer overflows in libastro (#72)

This commit is contained in:
gitplcc 2024-02-05 20:25:19 +01:00 committed by GitHub
parent 6e454dff89
commit 3618b3a203
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -1673,7 +1673,7 @@ cns_loadfigs (FILE *fp, char *msg)
continue;
/* ok, line looks interesting, look more carefully */
if (sscanf (lp, "%d %s %s", &code, rastr, decstr) == 3) {
if (sscanf (lp, "%d %63s %63s", &code, rastr, decstr) == 3) {
/* looks like a drawing line */
double ra, dec;

View File

@ -148,7 +148,7 @@ GEOMAG:
c[0][0] = 0.0;
cd[0][0] = 0.0;
fgets(c_str, 80, wmmdat);
sscanf(c_str,"%f%s",&epoc,model);
sscanf(c_str,"%f%19s",&epoc,model);
S3:
fgets(c_str, 80, wmmdat);
/* CHECK FOR LAST LINE IN FILE */

View File

@ -140,7 +140,7 @@ obj_description (Obj *op)
return ("Planet");
if (!biop)
getBuiltInObjs (&biop);
sprintf (nsstr, "Moon of %s", biop[op->pl_code].o_name);
sprintf (nsstr, "Moon of %7s", biop[op->pl_code].o_name);
return (nsstr);
}
case EARTHSAT: