source: scripts/patches/gawk-3.1.5-segfault_fix-1.patch@ c3ed84c

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since c3ed84c was dd6636b, checked in by Jim Gifford <clfs@…>, 19 years ago

r2507@server (orig r1246): ryan | 2006-03-10 02:07:32 -0800

r1296@rei: lfs | 2006-03-09 18:34:49 +1100
Add gawk-3.1.5-segfault_fix-1.patch
-----------------------------------
Submitted By: Matthew Burgess <matthew@…>
Date: 2005-09-24
Initial Package Version: 3.1.5
Upstream Status: From Upstream
Origin: http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html
Description: Fixes a bug which causes gawk to segfault when operating on a non-existent file.



  • Property mode set to 100644
File size: 1.3 KB
  • gawk-3.1.5

    Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
    Date: 2005-09-24
    Initial Package Version: 3.1.5
    Upstream Status: From Upstream
    Origin: http://lists.gnu.org/archive/html/bug-gnu-utils/2005-08/msg00047.html
    Description: Fixes a bug which causes gawk to segfault when operating on a non-existent file.
    
    diff -Naur gawk-3.1.5.orig/io.c gawk-3.1.5/io.c
    old new  
    24802480{
    24812481        struct stat sbuf;
    24822482        struct open_hook *oh;
     2483        int iop_malloced = FALSE;
    24832484
    2484         if (iop == NULL)
     2485        if (iop == NULL) {
    24852486                emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc");
     2487                iop_malloced = TRUE;
     2488        }
    24862489        memset(iop, '\0', sizeof(IOBUF));
    24872490        iop->flag = 0;
    24882491        iop->fd = fd;
     
    24952498        }
    24962499
    24972500        if (iop->fd == INVALID_HANDLE) {
    2498                 free(iop);
     2501                if (iop_malloced)
     2502                        free(iop);
    24992503                return NULL;
    25002504        }
    25012505        if (isatty(iop->fd))
     
    25032507        iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf);
    25042508        iop->sbuf = sbuf;
    25052509        if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
    2506                         lintwarn(_("data file `%s' is empty"), name);
     2510                lintwarn(_("data file `%s' is empty"), name);
    25072511        errno = 0;
    25082512        iop->count = iop->scanoff = 0;
    25092513        emalloc(iop->buf, char *, iop->size += 2, "iop_alloc");
Note: See TracBrowser for help on using the repository browser.