Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/makemandb We do need to copy the return value from ...
details: https://anonhg.NetBSD.org/src/rev/6fb2594a91e3
branches: trunk
changeset: 823679:6fb2594a91e3
user: abhinav <abhinav%NetBSD.org@localhost>
date: Tue May 02 13:54:08 2017 +0000
description:
We do need to copy the return value from dirname(3) since there it is a static
buffer and can be overwritten in between. I overzealously removed this in one
of my previous commits.
diffstat:
usr.sbin/makemandb/makemandb.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 8096c991a7bd -r 6fb2594a91e3 usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c Tue May 02 08:20:20 2017 +0000
+++ b/usr.sbin/makemandb/makemandb.c Tue May 02 13:54:08 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: makemandb.c,v 1.53 2017/05/01 06:56:00 abhinav Exp $ */
+/* $NetBSD: makemandb.c,v 1.54 2017/05/02 13:54:08 abhinav Exp $ */
/*
* Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
* Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: makemandb.c,v 1.53 2017/05/01 06:56:00 abhinav Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.54 2017/05/02 13:54:08 abhinav Exp $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -450,9 +450,10 @@
while ((len = getline(&line, &linesize, file)) != -1) {
/* Replace the new line character at the end of string with '\0' */
line[len - 1] = '\0';
- char *pdir = dirname(line);
+ char *pdir = estrdup(dirname(line));
/* Traverse the man page directories and parse the pages */
traversedir(pdir, line, db, mp);
+ free(pdir);
}
free(line);
Home |
Main Index |
Thread Index |
Old Index