fix(libastro): prevent buffer overflow reading external files

This commit is contained in:
gitplcc 2023-01-04 16:32:28 +01:00 committed by GitHub
parent cc1ef1bfb4
commit ca4c9e8f9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 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 */