Revision: 49080 http://brlcad.svn.sourceforge.net/brlcad/?rev=49080&view=rev Author: n_reed Date: 2012-01-25 20:52:15 +0000 (Wed, 25 Jan 2012) Log Message: ----------- Forgot that we need to search for closing brace of character classes. Was causing truncated conversion specification.
Modified Paths: -------------- brlcad/trunk/src/libbu/sscanf.c Modified: brlcad/trunk/src/libbu/sscanf.c =================================================================== --- brlcad/trunk/src/libbu/sscanf.c 2012-01-25 20:36:50 UTC (rev 49079) +++ brlcad/trunk/src/libbu/sscanf.c 2012-01-25 20:52:15 UTC (rev 49080) @@ -89,9 +89,13 @@ static char* getSubstring(const char *srcStart, const char *srcEnd) { - size_t size = (size_t)srcEnd - (size_t)srcStart + 1; - char *sub = (char*)bu_malloc(size * sizeof(char), "getSubstring"); + size_t size; + char *sub; + + size = (size_t)srcEnd - (size_t)srcStart + 1; + sub = (char*)bu_malloc(size * sizeof(char), "getSubstring"); bu_strlcpy(sub, srcStart, size); + return sub; } @@ -315,6 +319,36 @@ case '[': flags |= NOSKIP; c = CT_CCL; + + /* note that at this point c == '[' == fmt[-1] and so fmt[0] is + * either '^' or the first character of the class + */ + + /* there should be at least one character in between brackets */ + if (fmt[0] == '\0' || fmt[1] == '\0') { + /* error */ + goto exit; + } + + /* skip literal ']' ("[]" or "[^]") */ + if (fmt[0] == ']') { + fmt = &fmt[1]; + } else if (fmt[0] == '^' && fmt[1] == ']') { + fmt = &fmt[2]; + } + + /* point fmt after character class */ + while (1) { + c = *fmt++; + if (c == '\0') { + /* error */ + goto exit; + } + if (c == ']') { + /* found end of character class */ + break; + } + } break; case 'C': /* XXX This may be a BSD extension. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits