]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Correctly check for long lines when checking for the last match
authorPatrice Fournier <pfournier@ifax.com>
Fri, 5 Feb 2010 23:34:34 +0000 (18:34 -0500)
committerAidan Van Dyk <mountie@cherry.home.highrise.ca>
Wed, 29 Jun 2011 13:31:49 +0000 (09:31 -0400)
Bodo Meissner found that textfmt would wrongfully return a line
too long error message in some circumstances and suggested a
fix for this.

libhylafax/TextFormat.c++

index dad03789a91008ec373eb8047cd9b5fca013584e..5aba423069e08551d57a02816ded7f2eb89c8ec1 100644 (file)
@@ -1190,13 +1190,13 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg)
                     fxStr val = tmp;
                     while (fgets(buf, sizeof(buf), fd) != NULL) {
                         len = strcspn(buf, "%\n");
-                        *(buf + len) = '\0';
                         if (len == strlen(buf)) {
                            emsg = fxStr::format(
                                NLS::TEXT("Warning: %s - line too long."), (const char*) fontMapFile);
                            break;
                         }
                        if (len == 0) continue;
+                       *(buf + len) = '\0';
                        tmp = buf + strcspn(buf, ") \t");
                        *tmp++ = '\0';
                         tmp += strspn(tmp, " \t");