On Fri, Jul 12, 2013 at 03:04:41PM +0100, Andrew Cooper wrote: > On 12/07/13 14:48, Daniel Kiper wrote: > > get_pt_note_info() always ignores VMCOREINFO_XEN note > > because buf size is too small. It does not have place > > for \0 char which marks EOS. This patch fixes that bug > > and VMCOREINFO_XEN note living in /proc/vmcore file > > could be properly detected now. > > > > Signed-off-by: Daniel Kiper <daniel.kiper at oracle.com> > > --- > > elf_info.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/elf_info.c b/elf_info.c > > index 0c1e36a..70a6dd2 100644 > > --- a/elf_info.c > > +++ b/elf_info.c > > @@ -310,7 +310,7 @@ get_pt_note_info(void) > > { > > int n_type, size_name, size_desc; > > off_t offset, offset_desc; > > - char buf[VMCOREINFO_XEN_NOTE_NAME_BYTES]; > > + char buf[VMCOREINFO_XEN_NOTE_NAME_BYTES + 1]; > > char note[MAX_SIZE_NHDR]; > > > > nr_cpus = 0; > > Elf Note namesz is defined to include the terminating null character, so > I would argue that VMCOREINFO_XEN_NOTE_NAME_BYTES is off-by-one. I have checked that once again. By mistake I have assumed that sizeof("string") does not take into account \0 char (like strlen()). It means that in real buf could accommodate VMCOREINFO_XEN string with EOS and relevant condition should be fixed instead of buf size. I will fix it in second patch series release. Thanks, Daniel