diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2013-03-26 14:54:30 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2014-03-28 11:04:14 -0700 |
commit | 09fadd948f9011c308be671dac979e0566feafdf (patch) | |
tree | fd59c1e4a182062eb2bc162d9fe5f1d6736d0d6f /usr/src | |
parent | a5602e1bdcf9570fa24684b54cf57a3f22e05ae1 (diff) | |
download | illumos-gate-09fadd948f9011c308be671dac979e0566feafdf.tar.gz |
4659 grub corrupts stack while installing stage1.5
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src')
-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 6213dc8d1c..17eb542a1e 100644 --- a/usr/src/grub/grub-0.97/stage2/builtins.c +++ b/usr/src/grub/grub-0.97/stage2/builtins.c @@ -4495,15 +4495,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 f29164712e..7146377cd0 100644 --- a/usr/src/grub/grub-0.97/stage2/char_io.c +++ b/usr/src/grub/grub-0.97/stage2/char_io.c @@ -1062,10 +1062,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; |