aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hlr_auc_gw.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-07-18 19:53:07 (GMT)
committerJouni Malinen <j@w1.fi>2015-07-18 19:55:02 (GMT)
commit3dfaedb433ab7b69f4d2bbe5cf8894a8a6277bfe (patch)
tree995749a83f96035cee8c51ca445d6999c7f0685e /hostapd/hlr_auc_gw.c
parent3b765ea545a89b29826458cdd1f0f04130463594 (diff)
downloadhostap-3dfaedb433ab7b69f4d2bbe5cf8894a8a6277bfe.zip
hostap-3dfaedb433ab7b69f4d2bbe5cf8894a8a6277bfe.tar.gz
hostap-3dfaedb433ab7b69f4d2bbe5cf8894a8a6277bfe.tar.bz2
hlr_auc_gw: Hide a bogus static analyzer warning
For some reason, snprintf() was not seen as sufficient to remove potentially tainted string from fgets() before passing this to rename(). This does not make much sense, but anyway, try to get rid of the warning by using a separate buffer for the internally written file names. (CID 72690) Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd/hlr_auc_gw.c')
-rw-r--r--hostapd/hlr_auc_gw.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/hostapd/hlr_auc_gw.c b/hostapd/hlr_auc_gw.c
index 8afe457..84d0308 100644
--- a/hostapd/hlr_auc_gw.c
+++ b/hostapd/hlr_auc_gw.c
@@ -550,7 +550,7 @@ static int read_milenage(const char *fname)
static void update_milenage_file(const char *fname)
{
FILE *f, *f2;
- char buf[500], *pos;
+ char name[500], buf[500], *pos;
char *end = buf + sizeof(buf);
struct milenage_parameters *m;
size_t imsi_len;
@@ -561,10 +561,10 @@ static void update_milenage_file(const char *fname)
return;
}
- snprintf(buf, sizeof(buf), "%s.new", fname);
- f2 = fopen(buf, "w");
+ snprintf(name, sizeof(name), "%s.new", fname);
+ f2 = fopen(name, "w");
if (f2 == NULL) {
- printf("Could not write Milenage data file '%s'\n", buf);
+ printf("Could not write Milenage data file '%s'\n", name);
fclose(f);
return;
}
@@ -606,14 +606,14 @@ static void update_milenage_file(const char *fname)
fclose(f2);
fclose(f);
- snprintf(buf, sizeof(buf), "%s.bak", fname);
- if (rename(fname, buf) < 0) {
+ snprintf(name, sizeof(name), "%s.bak", fname);
+ if (rename(fname, name) < 0) {
perror("rename");
return;
}
- snprintf(buf, sizeof(buf), "%s.new", fname);
- if (rename(buf, fname) < 0) {
+ snprintf(name, sizeof(name), "%s.new", fname);
+ if (rename(name, fname) < 0) {
perror("rename");
return;
}