Re: [PATCH 1/2] Fix off-by-one error in string initialization (#577413)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 03/29/2010 12:50 PM, Martin Sivak wrote:
---
  loader/lang.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/loader/lang.c b/loader/lang.c
index c74a11b..564cc30 100644
--- a/loader/lang.c
+++ b/loader/lang.c
@@ -252,7 +252,7 @@ static int setupLanguage(int choice, int forced) {
      isysLoadFont();

      /* clear out top line */
-    buf = alloca(80);
+    buf = alloca(81); /* reserve one byte for \0 */
      for (i=0; i<  80; i++)
  	buf[i] = ' ';
      newtDrawRootText(0, 0, buf);

You also need to make sure buf[80] = 0, alloca does not give
you pre-zeroed memory.

Regards,

Hans

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux