Print this page
3027 installgrub can segfault when encountering bogus data on disk


  29 extern "C" {
  30 #endif
  31 
  32 #include <stdarg.h>
  33 #include <sys/types.h>
  34 #include "bblk_einfo.h"
  35 
  36 /* multiboot header needs to be located in the first 32KB. */
  37 #define MBOOT_SCAN_SIZE         (32 * 1024 * 1024)
  38 
  39 /* multiboot header AOUT_KLUDGE flag. */
  40 #define BB_MBOOT_AOUT_FLAG      (0x00010000)
  41 
  42 /* Extra header preceeding the payloads at the end of the bootblock. */
  43 typedef struct _bb_extra_header {
  44         uint32_t        size;
  45         uint32_t        checksum;
  46 } bb_header_ext_t;
  47 
  48 uint32_t compute_checksum(char *, uint32_t);
  49 bblk_einfo_t *find_einfo(char *);
  50 int find_multiboot(char *, uint32_t, uint32_t *);
  51 void add_einfo(char *, char *, bblk_hs_t *, uint32_t);
  52 int compare_bootblocks(char *, char *, char **);
  53 
  54 #ifdef  __cplusplus
  55 }
  56 #endif
  57 
  58 #endif /* _MBOOT_EXTRA_H */


  29 extern "C" {
  30 #endif
  31 
  32 #include <stdarg.h>
  33 #include <sys/types.h>
  34 #include "bblk_einfo.h"
  35 
  36 /* multiboot header needs to be located in the first 32KB. */
  37 #define MBOOT_SCAN_SIZE         (32 * 1024 * 1024)
  38 
  39 /* multiboot header AOUT_KLUDGE flag. */
  40 #define BB_MBOOT_AOUT_FLAG      (0x00010000)
  41 
  42 /* Extra header preceeding the payloads at the end of the bootblock. */
  43 typedef struct _bb_extra_header {
  44         uint32_t        size;
  45         uint32_t        checksum;
  46 } bb_header_ext_t;
  47 
  48 uint32_t compute_checksum(char *, uint32_t);
  49 bblk_einfo_t *find_einfo(char *, uint32_t);
  50 int find_multiboot(char *, uint32_t, uint32_t *);
  51 void add_einfo(char *, char *, bblk_hs_t *, uint32_t);
  52 int compare_bootblocks(char *, char *, char **);
  53 
  54 #ifdef  __cplusplus
  55 }
  56 #endif
  57 
  58 #endif /* _MBOOT_EXTRA_H */