gdbm/0000-Fix-gdbmtool-import-command.patch
Zhiqiang Liu 7f77045b6e gdbm: fix stack overflow in print_usage
fix stack overflow in print_usage.

Fix issue: https://gitee.com/src-openeuler/gdbm/issues/I4RV4Y

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
(cherry picked from commit ca90a8d9d8ce2e18762415e9e30482fed280c6f0)
2022-03-02 14:18:20 +08:00

37 lines
1.1 KiB
Diff

From 4f456e7c4b9e3727a83bc3d30ac929402f7ef81a Mon Sep 17 00:00:00 2001
From: yangchenguang <yangchenguang@uniontech.com>
Date: Fri, 19 Nov 2021 10:44:24 +0800
Subject: [PATCH] Fix gdbmtool import command
* src/gdbmtool.c (import_handler): Fix option addressing (see
https://puszcza.gnu.org.ua/bugs/?535).
Fix freeing of the uninitialized variable.
---
src/gdbmtool.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index bbadbae..03ba482 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -1003,7 +1003,7 @@ import_handler (struct handler_param *param)
int i;
int rc;
- for (i = 0; i < param->argc; i++)
+ for (i = 1; i < param->argc; i++)
{
if (strcmp (PARAM_STRING (param, i), "replace") == 0)
flag = GDBM_REPLACE;
@@ -1054,7 +1054,6 @@ import_handler (struct handler_param *param)
return;
}
- free (file_name);
if (gdbm_setopt (gdbm_file, GDBM_GETDBNAME, &file_name, sizeof (file_name)))
terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
}
--
2.20.1