Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
inspection: Don't segfault if /etc/SuSE-release is an empty file.
Related to CVE-2013-2124.

Thanks: Olaf Hering.
  • Loading branch information
rwmjones committed May 31, 2013
1 parent 36d6df6 commit ae8bb84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/inspect-fs-unix.c
Expand Up @@ -338,10 +338,11 @@ parse_suse_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
if (lines == NULL)
return -1;

if (lines[0] != NULL)
goto out;

/* First line is dist release name */
fs->product_name = safe_strdup (g, lines[0]);
if (fs->product_name == NULL)
goto out;

/* Match SLES first because openSuSE regex overlaps some SLES release strings */
if (match (g, fs->product_name, re_sles) || match (g, fs->product_name, re_nld)) {
Expand Down

0 comments on commit ae8bb84

Please sign in to comment.