Fix reading beyond string in yaz_sort_spec
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 16 Apr 2012 08:32:28 +0000 (10:32 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 16 Apr 2012 08:32:28 +0000 (10:32 +0200)
Spotted by Debians buildds output:
https://buildd.debian.org/fetch.cgi?pkg=yaz&arch=mips&
 ver=4.2.30-1&stamp=1334563202&file=log

src/sortspec.c

index 990c9a4..7e0f7fc 100644 (file)
@@ -123,7 +123,7 @@ Z_SortKeySpecList *yaz_sort_spec(ODR out, const char *arg)
                 sks->u.missingValueData->size = sks->u.missingValueData->len;
                 sks->u.missingValueData->buf = (unsigned char*)
                                           odr_strdup(out, sort_flags+i);
-                i += strlen(sort_flags+i);
+                i += strlen(sort_flags+i) - 1;
             }
         }
     }