diff --git a/ChangeLog b/ChangeLog index e6cc3a704..312506637 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-11-12 Vladimir Serbinenko + + * grub-core/fs/proc.c: Allow \0 in proc files. + 2013-11-12 Vladimir Serbinenko * grub-core/tests/xnu_uuid_test.c: Fix assert message. diff --git a/grub-core/fs/proc.c b/grub-core/fs/proc.c index 8f27682a2..770721ab9 100644 --- a/grub-core/fs/proc.c +++ b/grub-core/fs/proc.c @@ -128,10 +128,11 @@ grub_procfs_open (struct grub_file *file, const char *path) FOR_LIST_ELEMENTS((entry), (grub_procfs_entries)) if (grub_strcmp (pathptr, entry->name) == 0) { - file->data = entry->get_contents (); + grub_size_t sz; + file->data = entry->get_contents (&sz); if (!file->data) return grub_errno; - file->size = grub_strlen (file->data); + file->size = sz; return GRUB_ERR_NONE; } diff --git a/grub-core/tests/cmdline_cat_test.c b/grub-core/tests/cmdline_cat_test.c index c24c7639a..55e90a9d7 100644 --- a/grub-core/tests/cmdline_cat_test.c +++ b/grub-core/tests/cmdline_cat_test.c @@ -54,8 +54,9 @@ static const char testfile[] = ; static char * -get_test_txt (void) +get_test_txt (grub_size_t *sz) { + *sz = grub_strlen (testfile); return grub_strdup (testfile); } diff --git a/grub-core/tests/gfxterm_menu.c b/grub-core/tests/gfxterm_menu.c index bb456a2ae..915875909 100644 --- a/grub-core/tests/gfxterm_menu.c +++ b/grub-core/tests/gfxterm_menu.c @@ -57,8 +57,9 @@ static const char testfile[] = "timeout=3\n"; static char * -get_test_cfg (void) +get_test_cfg (grub_size_t *sz) { + *sz = grub_strlen (testfile); return grub_strdup (testfile); } diff --git a/include/grub/procfs.h b/include/grub/procfs.h index 55cbb2152..d393da77f 100644 --- a/include/grub/procfs.h +++ b/include/grub/procfs.h @@ -27,7 +27,7 @@ struct grub_procfs_entry struct grub_procfs_entry **prev; const char *name; - char * (*get_contents) (void); + char * (*get_contents) (grub_size_t *sz); }; extern struct grub_procfs_entry *grub_procfs_entries;