Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 150541 Details for
Bug 233161
CVE-2007-1536 file 4.20 fixes a heap overflow in that can result in arbitrary code execution
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch supplied from Ubuntu
ubuntu.patch (text/plain), 2.76 KB, created by
Josh Bressers
on 2007-03-20 22:58:40 UTC
(
hide
)
Description:
Patch supplied from Ubuntu
Filename:
MIME Type:
Creator:
Josh Bressers
Created:
2007-03-20 22:58:40 UTC
Size:
2.76 KB
patch
obsolete
>--- file-4.19.orig/src/magic.c >+++ file-4.19/src/magic.c >@@ -94,7 +94,7 @@ > goto free1; > } > >- ms->o.ptr = ms->o.buf = malloc(ms->o.size = 1024); >+ ms->o.ptr = ms->o.buf = malloc(ms->o.left = ms->o.size = 1024); > if (ms->o.buf == NULL) > goto free1; > >@@ -106,7 +106,6 @@ > if (ms->c.off == NULL) > goto free3; > >- ms->o.len = 0; > ms->haderr = 0; > ms->error = -1; > ms->mlist = NULL; >only in patch2: >unchanged: >--- file-4.19.orig/src/file.h >+++ file-4.19/src/file.h >@@ -276,7 +276,7 @@ > /* Accumulation buffer */ > char *buf; > char *ptr; >- size_t len; >+ size_t left; > size_t size; > /* Printable buffer */ > char *pbuf; >only in patch2: >unchanged: >--- file-4.19.orig/src/funcs.c >+++ file-4.19/src/funcs.c >@@ -26,6 +26,7 @@ > */ > #include "file.h" > #include "magic.h" >+#include <assert.h> > #include <stdarg.h> > #include <stdlib.h> > #include <string.h> >@@ -52,28 +53,32 @@ > file_printf(struct magic_set *ms, const char *fmt, ...) > { > va_list ap; >- size_t len; >+ size_t len, size; > char *buf; > > va_start(ap, fmt); > >- if ((len = vsnprintf(ms->o.ptr, ms->o.len, fmt, ap)) >= ms->o.len) { >+ if ((len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap)) >= ms->o.left) { >+ long diff; /* XXX: really ptrdiff_t */ >+ > va_end(ap); >- if ((buf = realloc(ms->o.buf, len + 1024)) == NULL) { >- file_oomem(ms, len + 1024); >+ size = (ms->o.size - ms->o.left) + len + 1024; >+ if ((buf = realloc(ms->o.buf, size)) == NULL) { >+ file_oomem(ms, size); > return -1; > } >- ms->o.ptr = buf + (ms->o.ptr - ms->o.buf); >+ diff = ms->o.ptr - ms->o.buf; >+ ms->o.ptr = buf + diff; > ms->o.buf = buf; >- ms->o.len = ms->o.size - (ms->o.ptr - ms->o.buf); >- ms->o.size = len + 1024; >+ ms->o.left = size - diff; >+ ms->o.size = size; > > va_start(ap, fmt); >- len = vsnprintf(ms->o.ptr, ms->o.len, fmt, ap); >+ len = vsnprintf(ms->o.ptr, ms->o.left, fmt, ap); > } >- ms->o.ptr += len; >- ms->o.len -= len; > va_end(ap); >+ ms->o.ptr += len; >+ ms->o.left -= len; > return 0; > } > >@@ -172,8 +177,8 @@ > protected const char * > file_getbuffer(struct magic_set *ms) > { >- char *nbuf, *op, *np; >- size_t nsize; >+ char *pbuf, *op, *np; >+ size_t psize, len; > > if (ms->haderr) > return NULL; >@@ -181,14 +186,17 @@ > if (ms->flags & MAGIC_RAW) > return ms->o.buf; > >- nsize = ms->o.len * 4 + 1; >- if (ms->o.psize < nsize) { >- if ((nbuf = realloc(ms->o.pbuf, nsize)) == NULL) { >- file_oomem(ms, nsize); >+ len = ms->o.size - ms->o.left; >+ /* * 4 is for octal representation, + 1 is for NUL */ >+ psize = len * 4 + 1; >+ assert(psize > len); >+ if (ms->o.psize < psize) { >+ if ((pbuf = realloc(ms->o.pbuf, psize)) == NULL) { >+ file_oomem(ms, psize); > return NULL; > } >- ms->o.psize = nsize; >- ms->o.pbuf = nbuf; >+ ms->o.psize = psize; >+ ms->o.pbuf = pbuf; > } > > #if defined(HAVE_WCHAR_H) && defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 233161
: 150541