Commit 5587276b authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

table::decodeForm1: missing longname results in Abort trap (bug fix)

parent c922275c
2014-11-20 Uwe Schulzweida
* table::decodeForm1: missing longname results in Abort trap (bug fix)
2014-11-14 Uwe Schulzweida 2014-11-14 Uwe Schulzweida
* cdfCopyRecord: removed limit for datasize * cdfCopyRecord: removed limit for datasize
......
...@@ -205,16 +205,21 @@ decodeForm1(char *pline, char *name, char *longname, char *units) ...@@ -205,16 +205,21 @@ decodeForm1(char *pline, char *name, char *longname, char *units)
while ( isspace((int) *pline) ) pline++; while ( isspace((int) *pline) ) pline++;
len = strlen(pline); len = strlen(pline);
if ( len > 0) if ( len > 0 )
{ {
pstart = pline; pstart = pline;
pend = strrchr(pline, '['); pend = strrchr(pline, '[');
if ( pend ) if ( pend == pstart )
pend--; len = 0;
else else
pend = pstart + len; {
while ( isspace((int) *pend) ) pend--; if ( pend )
len = (size_t)(pend - pstart + 1); pend--;
else
pend = pstart + len;
while ( isspace((int) *pend) ) pend--;
len = (size_t)(pend - pstart + 1);
}
if ( len > 0 ) if ( len > 0 )
{ {
memcpy(longname, pstart, len); memcpy(longname, pstart, len);
...@@ -234,10 +239,10 @@ decodeForm1(char *pline, char *name, char *longname, char *units) ...@@ -234,10 +239,10 @@ decodeForm1(char *pline, char *name, char *longname, char *units)
{ {
memcpy(units, pstart, len); memcpy(units, pstart, len);
units[len] = 0; units[len] = 0;
} }
} }
} }
return (0); return (0);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment