From f95b84e913eee5b7cf800fee89c7b10bea05d090 Mon Sep 17 00:00:00 2001
From: Enrico Turri <enricoturri@seznam.cz>
Date: Wed, 5 Sep 2018 09:49:10 +0200
Subject: [PATCH] Fixed stl import when endsolid lines contains extra data

---
 xs/src/admesh/stlinit.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xs/src/admesh/stlinit.cpp b/xs/src/admesh/stlinit.cpp
index e572ce930..ed8beb9d1 100644
--- a/xs/src/admesh/stlinit.cpp
+++ b/xs/src/admesh/stlinit.cpp
@@ -287,7 +287,7 @@ stl_read(stl_file *stl, int first_facet, int first) {
     {
       // skip solid/endsolid
       // (in this order, otherwise it won't work when they are paired in the middle of a file)
-      fscanf(stl->fp, "endsolid\n");
+      fscanf(stl->fp, "endsolid%*[^\n]\n");
       fscanf(stl->fp, "solid%*[^\n]\n");  // name might contain spaces so %*s doesn't work and it also can be empty (just "solid")
       // Leading space in the fscanf format skips all leading white spaces including numerous new lines and tabs.
       int res_normal     = fscanf(stl->fp, " facet normal %31s %31s %31s", normal_buf[0], normal_buf[1], normal_buf[2]);