From ac68d205e48a653ec5ca351e16d033164870eb38 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Thu, 20 May 2010 18:13:09 -0300 Subject: [PATCH] obexd: Fix invalid memory access when removing a file --- obexd/src/obex-priv.h | 2 +- obexd/src/obex.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/obexd/src/obex-priv.h b/obexd/src/obex-priv.h index 0f167ce61..265ac8ccc 100644 --- a/obexd/src/obex-priv.h +++ b/obexd/src/obex-priv.h @@ -45,7 +45,7 @@ struct obex_session { uint8_t cmd; char *name; char *type; - const char *path; + char *path; time_t time; uint8_t *buf; int32_t pending; diff --git a/obexd/src/obex.c b/obexd/src/obex.c index 38ff4388a..0f860d826 100644 --- a/obexd/src/obex.c +++ b/obexd/src/obex.c @@ -132,6 +132,10 @@ static void os_reset_session(struct obex_session *os) g_free(os->buf); os->buf = NULL; } + if (os->path) { + g_free(os->path); + os->path = NULL; + } os->driver = NULL; os->aborted = FALSE; @@ -693,7 +697,7 @@ int obex_put_stream_start(struct obex_session *os, const char *filename) return -EPERM; } - os->path = filename; + os->path = g_strdup(filename); if (!os->buf) { debug("PUT request checked, no buffered data"); -- 2.47.3