Projects
Factory:RISC-V:Base
cracklib
_service:tar_scm:fix-truncating-dict-file-witho...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:fix-truncating-dict-file-without-input-data.patch of Package cracklib
From 17970a5f2092f699ffb2f22a7fd6c40456907987 Mon Sep 17 00:00:00 2001 From: yixiangzhike <yixiangzhike007@163.com> Date: Sat, 13 Aug 2022 12:01:45 +0800 Subject: [PATCH] Fix truncating dict file without input data diff --git a/util/packer.c b/util/packer.c index e3f9500..4867641 100644 --- a/util/packer.c +++ b/util/packer.c @@ -22,6 +22,7 @@ main(argc, argv) PWDICT *pwp; char buffer[STRINGSIZE], prev[STRINGSIZE]; char *file; + char opened = 0; if (argc <= 1) { @@ -39,12 +40,6 @@ main(argc, argv) return (-1); } - if (!(pwp = PWOpen(file, "w"))) - { - perror(file); - return (-1); - } - wrote = 0; prev[0] = '\0'; @@ -62,6 +57,16 @@ main(argc, argv) continue; } + if (!opened) + { + if (!(pwp = PWOpen(file, "w"))) + { + perror(file); + return (-1); + } + opened = 1; + } + /* * If this happens, strcmp() in FindPW() in packlib.c will be unhappy. */ @@ -79,7 +84,8 @@ main(argc, argv) wrote++; } - PWClose(pwp); + if (opened) + PWClose(pwp); printf("%lu %lu\n", readed, wrote); -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2