From: Theodore Ts'o Date: Tue, 21 Dec 2010 23:12:12 +0000 (-0500) Subject: mke2fs: Avoid potential NULL dereference X-Git-Tag: v1.41.90.wc1~19 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=74e1211b2329b6c778ac4f834cc9e38f855ebaa0;p=tools%2Fe2fsprogs.git mke2fs: Avoid potential NULL dereference ... in the very unlikely case that e2p_os2string fails to allocate memory. Reported-by: Namhyung Kim Signed-off-by: "Theodore Ts'o" --- diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 9010f53..9c8ccfc 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -552,11 +552,10 @@ static void show_stats(ext2_filsys fs) memset(buf, 0, sizeof(buf)); strncpy(buf, s->s_volume_name, sizeof(s->s_volume_name)); printf(_("Filesystem label=%s\n"), buf); - fputs(_("OS type: "), stdout); - os = e2p_os2string(fs->super->s_creator_os); - fputs(os, stdout); + os = e2p_os2string(fs->super->s_creator_os); + if (os) + printf(_("OS type: %s\n"), os); free(os); - printf("\n"); printf(_("Block size=%u (log=%u)\n"), fs->blocksize, s->s_log_block_size); printf(_("Fragment size=%u (log=%u)\n"), fs->fragsize,