Skip to content

Commit 7f6c9cd

Browse files
authored
build-103-patch (#15)
1 parent 80f0316 commit 7f6c9cd

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

sign/signmanifest.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// $Id: signmanifest.cpp,v 1.4 2025/04/22 17:55:08 cvsuser Exp $
1+
// $Id: signmanifest.cpp,v 1.5 2025/04/23 11:17:53 cvsuser Exp $
22
//
33
// AutoUpdater: Manifest generation tool.
44
//
@@ -238,8 +238,8 @@ SignManifestEd(const char *filename, const char *version, const char *url,
238238
#endif
239239
strftime(pubDate, sizeof(pubDate), "%a, %d %b %Y %H:%M:%S +0000", &pubtime);
240240

241-
char url[1024] = {0};
242-
ReplaceString(url, "%%", basename, url, sizeof(url));
241+
char t_url[1024] = {0};
242+
ReplaceString(url, "%%", basename, t_url, sizeof(t_url));
243243

244244
std::cout
245245
<< "\n"
@@ -248,7 +248,7 @@ SignManifestEd(const char *filename, const char *version, const char *url,
248248
<< "\t<description></description>\n"
249249
<< "\t<published>" << now << "</published>\n"
250250
<< "\t<pubDate>" << pubDate << "</pubDate>\n"
251-
<< "\t<enclosure url=\"" << url << "\"\n"
251+
<< "\t<enclosure url=\"" << t_url << "\"\n"
252252
<< "\t\tos=\"windows\"\n"
253253
<< "\t\tname=\"" << basename << "\"\n"
254254
<< "\t\tversion=\"" << version << "\"\n"
@@ -353,9 +353,9 @@ Sign(const File& file, const struct SignKeyPair *key)
353353

354354
// failure
355355
{
356-
uint8_t t_signature[sizeof(signature)] = { 0 };
356+
uint8_t t_signature[sizeof(signature)] = {0};
357357
memcpy(t_signature, signature, sizeof(signature));
358-
t_signature[1] |= 1;
358+
t_signature[1] ^= 1;
359359
assert(1 != ed25519_verify(t_signature, file.fileBuffer, file.fileSize, key->public_key));
360360
}
361361
assert(1 != ed25519_verify(signature, file.fileBuffer, file.fileSize - 1, key->public_key));

src/AutoConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef AUTOCONFIG_H_INCLUDED
22
#define AUTOCONFIG_H_INCLUDED
3-
// $Id: AutoConfig.h,v 1.20 2025/04/22 17:25:25 cvsuser Exp $
3+
// $Id: AutoConfig.h,v 1.21 2025/04/23 11:16:40 cvsuser Exp $
44
//
55
// AutoUpdater: configuration management.
66
//

util/Base64.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#ifndef BASE64_H_INCLUDED
22
#define BASE64_H_INCLUDED
3-
// $Id: Base64.h,v 1.1 2025/04/21 13:58:28 cvsuser Exp $
3+
// $Id: Base64.h,v 1.2 2025/04/23 11:17:25 cvsuser Exp $
44
//
55
// AutoUpdater: base64 utils
66
//
@@ -40,7 +40,7 @@ class Base64 {
4040
static size_t
4141
encode_dstlength(size_t length)
4242
{
43-
return (length * 4 / 3 + 4) + 1; /* 3-byte blocks to 4-byte */
43+
return (length * 4 / 3 + 4) + 1; /* 3-byte blocks to 4-byte, plus nul */
4444
}
4545

4646
static int
@@ -91,7 +91,8 @@ class Base64 {
9191
{
9292
std::string result;
9393
result.resize(encode_dstlength(length));
94-
encode(src, length, const_cast<char *>(result.data()), result.size());
94+
int ret = encode(src, length, const_cast<char *>(result.data()), result.size());
95+
result.resize(ret <= 0 ? 0 : (size_t)(ret - /*nul*/1));
9596
return result;
9697
}
9798

@@ -182,4 +183,4 @@ class Base64 {
182183

183184
#endif //BASE64_H_INCLUDED
184185

185-
//end
186+
//end

0 commit comments

Comments
 (0)