=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cdio/cddb.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- src/usr.bin/cdio/cddb.c 2013/03/07 16:54:28 1.17 +++ src/usr.bin/cdio/cddb.c 2014/01/04 15:39:17 1.18 @@ -1,4 +1,4 @@ -/* $OpenBSD: cddb.c,v 1.17 2013/03/07 16:54:28 espie Exp $ */ +/* $OpenBSD: cddb.c,v 1.18 2014/01/04 15:39:17 tobias Exp $ */ /* * Copyright (c) 2002 Marc Espie. * @@ -345,7 +345,7 @@ if (!line) goto end2; for (;;) { - long k; + int k; char *end; line = get_line(cin); @@ -356,10 +356,12 @@ if (strncmp(line, "TTITLE", 6) != 0) continue; line += 6; - k = strtol(line, &end, 10); - if (*end++ != '=') + end = strchr(line, '='); + if (end == NULL) continue; - if (k >= n) + *end++ = '\0'; + k = strtonum(line, 0, n - 1, &errstr); + if (errstr != NULL) continue; safe_copy(&result[k], end); }