dhcpcd-discuss

Re: memory cruption problem

Roy Marples

Mon Jul 21 09:36:37 2014

On 2014-07-19 10:15, Roy Marples wrote:
Attached is a simpler patch which should fix your problem.
My testing time is limited today and I was unable to reproduce it
under valgrind so if you can test it and get back I'll commit it.

It would help if I attached the patch.
Here it is:

--- compat/getline.c
+++ compat/getline.c
@@ -53,11 +53,11 @@

        bytes = 0;
        do {
                if (feof(fp))
                        break;
-               if (*buf == NULL || bytes != 0) {
+               if (*buf == NULL || bytes != 0 || *buflen < BUFSIZ) {
                        newlen = *buflen + BUFSIZ;
                        newbuf = realloc(*buf, newlen);
                        if (newbuf == NULL)
                                return -1;
                        *buf = newbuf;


Follow-Ups:
Re:Re: memory cruption problemflxue2010
References:
memory cruption problemflxue2010
Re: memory cruption problemRoy Marples
Archive administrator: postmaster@marples.name