Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] fix for package/config/util.c
@ 2011-03-30 16:08 bbj17 at gmx.de
  0 siblings, 0 replies; 3+ messages in thread
From: bbj17 at gmx.de @ 2011-03-30 16:08 UTC (permalink / raw)
  To: buildroot

here is the correct diff:


 diff -Naur  package/config/util.c.old package/config/util.c
--- package/config/util.c.old   2011-03-30 17:37:08.016057639 +0200
+++ package/config/util.c       2011-03-30 17:42:26.911184273 +0200
@@ -35,12 +35,12 @@
        char *ret;
        if (len < 1)
                return NULL;
-       ret = malloc(len);
+       ret = malloc(len+1);
        if (!ret) {
                printf("Out of memory!");
                exit(1);
        }
-       memset(ret, 0, len);
+       memset(ret, 0, len+1);
        i = j = 0;
        if (strncmp("BR2_", in, 4) == 0)
                i += 4;


-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [Buildroot] fix for package/config/util.c
@ 2011-03-30 15:52 bbj17 at gmx.de
  2011-03-30 18:53 ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: bbj17 at gmx.de @ 2011-03-30 15:52 UTC (permalink / raw)
  To: buildroot

I found a bug in package/config/util.c (package/config/patches/08-make-write-deps.patch).

Symbols not starting with BR2_ / PACKAGE_ / TARGET_ will result in memory corruption.

--- package/config/util.c       2011-03-30 17:42:26.911184273 +0200
+++ package/config/util.c.old   2011-03-30 17:37:08.016057639 +0200
@@ -35,12 +35,12 @@
        char *ret;
        if (len < 1)
                return NULL;
-       ret = malloc(len+1);
+       ret = malloc(len);
        if (!ret) {
                printf("Out of memory!");
                exit(1);
        }
-       memset(ret, 0, len+1);
+       memset(ret, 0, len);
        i = j = 0;
        if (strncmp("BR2_", in, 4) == 0)
                i += 4;

Ben
-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit 
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-30 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 16:08 [Buildroot] fix for package/config/util.c bbj17 at gmx.de
  -- strict thread matches above, loose matches on Subject: below --
2011-03-30 15:52 bbj17 at gmx.de
2011-03-30 18:53 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox