diff --git a/src/avalanche/gistools/shapefile.C b/src/avalanche/gistools/shapefile.C
index 8de4200aeea30cd9f69749cc981d30705d6b316f..91dad6fc4e3ff8b43390fc61a9a8dc877e4f52db 100644
--- a/src/avalanche/gistools/shapefile.C
+++ b/src/avalanche/gistools/shapefile.C
@@ -1331,7 +1331,20 @@ int shapefile::write(std::string filename)
                 }
                 else if(this->fd_[j] > 0)
                 {
-                    snprintf(formatstr+1, 6, "%d.%df", this->fl_[j], this->fd_[j]);
+                    // TDB: use string concatenation?
+                    // eg,
+                    // std::string fmtstr
+                    // (
+                    //     "%" + std::to_string(this->fl_[j])
+                    //   + "." + std::to_string(this->fd_[j]) + "f"
+                    // );
+
+                    if (snprintf(formatstr+1, 6, "%d.%df", this->fl_[j], this->fd_[j]) < 0)
+                    {
+                        //should never happen but prevents gcc warning
+                        DebugInfo << "Format string exceeds 6 characters - not writing further." << std::endl;
+                        return 0;
+                    }
                     snprintf(buf, buflen+1, formatstr, v_[i][j]);
                 }
                 else