summaryrefslogtreecommitdiff
path: root/usr.bin/cdio/cddb.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2003-06-09 11:33:15 +0000
committerMarc Espie <espie@cvs.openbsd.org>2003-06-09 11:33:15 +0000
commit660267c7334b96dbaf65a39037fe5ff496c2ca4e (patch)
tree817a4dc76f8551a6fa057a4c4d93042ea88d9bf8 /usr.bin/cdio/cddb.c
parent1d91b777b103ae8b2efd63f1ebb323155c321042 (diff)
Protect all get_line calls against null pointers.
Problem pointed out by Pedro Bastos, thanks Pedro.
Diffstat (limited to 'usr.bin/cdio/cddb.c')
-rw-r--r--usr.bin/cdio/cddb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/cdio/cddb.c b/usr.bin/cdio/cddb.c
index e1c355b1b8d..89a6ea9c0df 100644
--- a/usr.bin/cdio/cddb.c
+++ b/usr.bin/cdio/cddb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cddb.c,v 1.7 2003/03/13 09:32:06 espie Exp $ */
+/* $OpenBSD: cddb.c,v 1.8 2003/06/09 11:33:14 espie Exp $ */
/*
* Copyright (c) 2002 Marc Espie.
*
@@ -222,7 +222,7 @@ get_answer(FILE *cin)
char *line;
line = get_line(cin);
- if (*line != '2')
+ if (!line || *line != '2')
return NULL;
else
return line;
@@ -306,7 +306,7 @@ cddb(const char *host_port, int n, struct cd_toc_entry *e, char *arg)
if (number == 0) {
for (i = 1;; i++) {
line = get_line(cin);
- if (strcmp(line, ".") == 0)
+ if (!line || strcmp(line, ".") == 0)
goto end;
printf("%d: %s\n", i, line);
}