diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2013-03-26 14:54:30 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2013-03-26 14:54:30 +0000 |
commit | e4d472e6c9c7536c2761c91e293f543f0e472fde (patch) | |
tree | d5ce41bf44340e067825ff6a37962a758bbadcaf /usr/src/grub | |
parent | 902e65d86f58ad1f0db957d5b9a44c26fb6df1b2 (diff) | |
download | illumos-joyent-e4d472e6c9c7536c2761c91e293f543f0e472fde.tar.gz |
OS-2076 grub corrupts stack while installing stage1.5
Diffstat (limited to 'usr/src/grub')
-rw-r--r-- | usr/src/grub/grub-0.97/stage2/builtins.c | 6 | ||||
-rw-r--r-- | usr/src/grub/grub-0.97/stage2/char_io.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/usr/src/grub/grub-0.97/stage2/builtins.c b/usr/src/grub/grub-0.97/stage2/builtins.c index 5294ded9c7..a6f5acd011 100644 --- a/usr/src/grub/grub-0.97/stage2/builtins.c +++ b/usr/src/grub/grub-0.97/stage2/builtins.c @@ -4457,15 +4457,15 @@ setup_func (char *arg, int flags) { char tmp[16]; grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF); - grub_strncat (device, tmp, 256); + grub_strncat (device, tmp, sizeof (device)); } if ((partition & 0x00FF00) != 0x00FF00) { char tmp[16]; grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF)); - grub_strncat (device, tmp, 256); + grub_strncat (device, tmp, sizeof (device)); } - grub_strncat (device, ")", 256); + grub_strncat (device, ")", sizeof (device)); } int embed_stage1_5 (char *stage1_5, int drive, int partition) diff --git a/usr/src/grub/grub-0.97/stage2/char_io.c b/usr/src/grub/grub-0.97/stage2/char_io.c index 3dd3544bf9..3557552e01 100644 --- a/usr/src/grub/grub-0.97/stage2/char_io.c +++ b/usr/src/grub/grub-0.97/stage2/char_io.c @@ -1063,10 +1063,10 @@ grub_strncat (char *s1, const char *s2, int n) while (i < n && (s1[i++] = *(s2++)) != 0); - s1[n - 1] = 0; - - if (i >= n) + if (i >= n) { + s1[n - 1] = 0; return 0; + } s1[i] = 0; |