From adde7bc588eed0e868c4b2ef5717c92c613372d3 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 25 Jan 2018 13:10:22 +1100 Subject: [PATCH] AP_Terrain: fix snprintf buffer length warning Also includes fix from Tridge to use MIN() instead of MAX() --- libraries/AP_Terrain/TerrainIO.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Terrain/TerrainIO.cpp b/libraries/AP_Terrain/TerrainIO.cpp index c1e684bf28..d08b9d0315 100644 --- a/libraries/AP_Terrain/TerrainIO.cpp +++ b/libraries/AP_Terrain/TerrainIO.cpp @@ -173,9 +173,9 @@ void AP_Terrain::open_file(void) } snprintf(p, 13, "/%c%02u%c%03u.DAT", block.lat_degrees<0?'S':'N', - abs((int32_t)block.lat_degrees), + MIN(abs((int32_t)block.lat_degrees), 99), block.lon_degrees<0?'W':'E', - abs((int32_t)block.lon_degrees)); + MIN(abs((int32_t)block.lon_degrees), 999)); // create directory if need be if (!directory_created) {