Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Anonymous
Saturday, March 8th, 2008 at 11:12:30pm UTC 

  1. Index: ata.c
  2. ===================================================================
  3. --- ata.c       (revision 16556)
  4. +++ ata.c       (working copy)
  5. @@ -81,6 +81,7 @@
  6.  #ifdef HAVE_LBA48
  7.  static bool lba48 = false; /* set for 48 bit addressing */
  8.  #endif
  9. +unsigned long sector_count = 0;
  10.  static long ata_stack[(DEFAULT_STACK_SIZE*3)/sizeof(long)];
  11.  static const char ata_thread_name[] = "ata";
  12.  static struct event_queue ata_queue;
  13. @@ -277,6 +278,9 @@
  14.      void* buf;
  15.      long spinup_start;
  16.  
  17. +    if((start + incount) > sector_count)
  18. +        return -6;
  19. +
  20.  #ifndef MAX_PHYS_SECTOR_SIZE
  21.  #ifdef HAVE_MULTIVOLUME
  22.      (void)drive; /* unused for now */
  23. @@ -482,6 +486,9 @@
  24.      int ret = 0;
  25.      long spinup_start;
  26.  
  27. +    if((start + count) > sector_count)
  28. +        panicf("Writing past end of disk\n");
  29. +
  30.  #ifndef MAX_PHYS_SECTOR_SIZE
  31.  #ifdef HAVE_MULTIVOLUME
  32.      (void)drive; /* unused for now */
  33. @@ -621,6 +628,9 @@
  34.      int rc = 0;
  35.      int offset;
  36.  
  37. +    if((start + incount) > sector_count)
  38. +        return -6;
  39. +
  40.  #ifdef HAVE_MULTIVOLUME
  41.      (void)drive; /* unused for now */
  42.  #endif
  43. @@ -687,6 +697,9 @@
  44.      int rc = 0;
  45.      int offset;
  46.  
  47. +    if((start + count) > sector_count)
  48. +        panicf("Writing past end of disk\n");
  49. +
  50.  #ifdef HAVE_MULTIVOLUME
  51.      (void)drive; /* unused for now */
  52.  #endif
  53. @@ -1246,8 +1259,17 @@
  54.              && identify_info[61] == 0x0FFF) /* (needs BigLBA addressing) */
  55.          {
  56.              lba48 = true; /* use BigLBA */
  57. -        }
  58. +            sector_count =  (unsigned long) identify_info[103] << 48 |
  59. +                            (unsigned long) identify_info[102] << 32 |
  60. +                            (unsigned long) identify_info[101] << 16 |
  61. +                            (unsigned long) identify_info[100];
  62. +        }   
  63. +        else
  64.  #endif
  65. +            sector_count =  (unsigned long) identify_info[61] << 16 |
  66. +                            (unsigned long) identify_info[60] ;
  67. +
  68. +
  69.          rc = freeze_lock();
  70.  
  71.          if (rc)

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right worth-right