Message ID | 1331254790-30221-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 03/09/2012 08:59 AM, Colin King wrote: > From: Colin Ian King<colin.king@canonical.com> > > Signed-off-by: Colin Ian King<colin.king@canonical.com> > --- > src/acpica/fwts_acpica.c | 10 ++++++++-- > 1 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c > index 096683a..609dc8f 100644 > --- a/src/acpica/fwts_acpica.c > +++ b/src/acpica/fwts_acpica.c > @@ -277,11 +277,17 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) > if (buffer_len == 0) { > buffer_len = tmp_len + 1; > buffer = malloc(buffer_len); > - strcpy(buffer, tmp); > + if (buffer) > + strcpy(buffer, tmp); > + else > + buffer_len = 0; > } else { > buffer_len += tmp_len; > buffer = realloc(buffer, buffer_len); > - strcat(buffer, tmp); > + if (buffer) > + strcat(buffer, tmp); > + else > + buffer_len = 0; > } > > if (index(buffer, '\n') != NULL) { Acked-by: Alex Hung <alex.hung@canonical.com>
On Fri, Mar 9, 2012 at 8:59 AM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpica/fwts_acpica.c | 10 ++++++++-- > 1 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c > index 096683a..609dc8f 100644 > --- a/src/acpica/fwts_acpica.c > +++ b/src/acpica/fwts_acpica.c > @@ -277,11 +277,17 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) > if (buffer_len == 0) { > buffer_len = tmp_len + 1; > buffer = malloc(buffer_len); > - strcpy(buffer, tmp); > + if (buffer) > + strcpy(buffer, tmp); > + else > + buffer_len = 0; > } else { > buffer_len += tmp_len; > buffer = realloc(buffer, buffer_len); > - strcat(buffer, tmp); > + if (buffer) > + strcat(buffer, tmp); > + else > + buffer_len = 0; > } > > if (index(buffer, '\n') != NULL) { > -- > 1.7.9 > Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c index 096683a..609dc8f 100644 --- a/src/acpica/fwts_acpica.c +++ b/src/acpica/fwts_acpica.c @@ -277,11 +277,17 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) if (buffer_len == 0) { buffer_len = tmp_len + 1; buffer = malloc(buffer_len); - strcpy(buffer, tmp); + if (buffer) + strcpy(buffer, tmp); + else + buffer_len = 0; } else { buffer_len += tmp_len; buffer = realloc(buffer, buffer_len); - strcat(buffer, tmp); + if (buffer) + strcat(buffer, tmp); + else + buffer_len = 0; } if (index(buffer, '\n') != NULL) {