- #4181, St_AsMVTGeom: Avoid type changes due to validation (Raúl Marín)
- #4183, St_AsMVTGeom: Drop invalid geometries after simplification (Raúl Marín)
- #4188, Avoid division by zero in kmeans (Raúl Marín)
+ - #4189, Fix undefined behaviour in SADFWrite (Raúl Marín)
PostGIS 2.5.0
2018/09/23
{
/* Add "..." prefix */
outstart = str + endpos + 1 - maxlength + 3;
- strncat(output, "...", 3);
+ strncat(output, "...", 4);
strncat(output, outstart, maxlength - 3);
}
else
{
/* maxlength is too small; just output "..." */
- strncat(output, "...", 3);
+ strncat(output, "...", 4);
}
}
}
/* Add "..." suffix */
outstart = str + startpos;
strncat(output, outstart, maxlength - 3);
- strncat(output, "...", 3);
+ strncat(output, "...", 4);
}
else
{
/* maxlength is too small; just output "..." */
- strncat(output, "...", 3);
+ strncat(output, "...", 4);
}
}
}
{
if (!strncasecmp(dbffieldname, state->dbffieldnames[j], 10))
{
- sprintf(dbffieldname, "%.7s_%.2d", ptr, tmpint % 100);
+ sprintf(dbffieldname, "%.7s_%.2d", ptr, abs(tmpint) % 100);
tmpint++;
continue;
}
SAOffset SADFWrite( void *p, SAOffset size, SAOffset nmemb, SAFile file )
{
- return (SAOffset) fwrite( p, (size_t) size, (size_t) nmemb,
- (FILE *) file );
+ if (!nmemb || !p) return 0;
+ return (SAOffset) fwrite( p, (size_t) size, (size_t) nmemb,
+ (FILE *) file );
}
/************************************************************************/