From 8913300997e9491fab8f3649e632251d06a3a8c2 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Tue, 7 Sep 2021 07:28:34 +0200 Subject: [PATCH] gnss: open temporary file as read/write Opening as write-only may cause undefined behavior when reading the file --- src/gnss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gnss.c b/src/gnss.c index aeb73af..aa1bb6f 100644 --- a/src/gnss.c +++ b/src/gnss.c @@ -190,7 +190,7 @@ static void fetch_assistance_data(struct EG25Manager *manager) long int size; /* Fetch assistance data with curl */ - tmp_file = fdopen(manager->gnss_assistance_fd, "wb"); + tmp_file = fdopen(manager->gnss_assistance_fd, "wb+"); url = g_strconcat(manager->gnss_assistance_url, "/", manager->gnss_assistance_file, NULL); curl = curl_easy_init();