Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
926a750
csum-file: drop discard_hashfile()
peff Jul 2, 2026
cdb20e9
hash: add discard primitive
peff Jul 2, 2026
64337ae
csum-file: always finalize or discard hash
peff Jul 2, 2026
46ba44e
csum-file: provide a function to release checkpoints
peff Jul 2, 2026
64b6922
patch-id: discard hash when done
peff Jul 2, 2026
77f78b8
check_stream_oid(): discard hash on read error
peff Jul 2, 2026
a2d8ea5
http: discard hash in dumb-http http_object_request
peff Jul 2, 2026
a51b545
hash: fix memory leak copying sha256 gcrypt handles
peff Jul 2, 2026
600588d
hash: add platform-specific discard functions
peff Jul 2, 2026
bad766f
ci(dockerized): raise the PID limit for private repositories
dscho Jul 4, 2026
1eb2811
precompose_utf8: use a flex array for d_name
booxter Jul 4, 2026
8b90835
load_one_loose_object_map(): fix resource leak
dscho Jul 5, 2026
bd58327
loose: avoid closing invalid fd on error path
dscho Jul 5, 2026
a62c2a2
download_https_uri_to_file(): do not leak fd upon failure
dscho Jul 5, 2026
c3f89be
run-command: avoid `close(-1)` in `start_command()` error paths
dscho Jul 5, 2026
da82221
line-log: avoid redundant copy that leaks in process_ranges
dscho Jul 5, 2026
6eb6005
dir: free allocations on parse-error paths in `read_one_dir()`
dscho Jul 5, 2026
add15d1
submodule: fix cwd leak in `get_superproject_working_tree()`
dscho Jul 5, 2026
da2211b
worktree: fix resource leaks when branch creation fails
dscho Jul 5, 2026
22f92aa
imap-send: avoid leaking the IMAP upload buffer
dscho Jul 5, 2026
b3b1d83
reftable/table: release filter on error path
dscho Jul 5, 2026
e36cda7
fsmonitor: plug token-data leak on early daemon-startup failures
dscho Jul 5, 2026
9184231
mingw: make `exit_process()` own the process handle on all paths
dscho Jul 5, 2026
fc1bac6
README: add GitLab CI badge to make it more discoverable
pks-t Jul 6, 2026
9769449
t0021: skip EXPENSIVE test that is broken without SIZE_T_IS_64BIT
pks-t Jul 6, 2026
f0598d0
t4141: fix inefficient use of dd(1)
pks-t Jul 6, 2026
bc1854f
t5608: reduce maximum disk usage
pks-t Jul 6, 2026
8f276d1
t7508: skip EXPENSIVE test that is broken without SIZE_T_IS_64BIT
pks-t Jul 6, 2026
aa4ee1f
t7900: clean up large EXPENSIVE repository
pks-t Jul 6, 2026
886c7b4
t: use `test_bool_env` to parse GIT_TEST_LONG
pks-t Jul 6, 2026
3e35bf7
gitlab-ci: disable RAM disk on macOS jobs
pks-t Jul 6, 2026
8424844
gitlab-ci: enable "GIT_TEST_LONG"
pks-t Jul 6, 2026
f08ece0
Merge branch 'jk/hash-algo-leak-fixes' into jk/git-hash-cleanups
gitster Jul 7, 2026
3792b2a
sideband: allow ANSI SGR with colon-separated subfields
grawity May 13, 2026
9b204b8
hash: use git_hash_init() consistently
peff Jul 8, 2026
b87af5a
hash: convert remaining direct function calls
peff Jul 8, 2026
90a55e3
hash: document function pointers and wrappers
peff Jul 8, 2026
2c51615
hash: make git_hash_discard() idempotent
peff Jul 8, 2026
6728cfb
csum-file: use idempotent git_hash_discard()
peff Jul 8, 2026
f1bf977
http: use idempotent git_hash_discard()
peff Jul 8, 2026
9e396aa
hash: check ctx->active flag in all wrapper functions
peff Jul 8, 2026
936eb75
wincred: avoid memory corruption when erasing a credential
dscho Jul 16, 2026
f635ab9
wincred: prevent silent credential loss when storing OAuth tokens
dscho Jul 16, 2026
62c9cec
Merge branch 'js/wincred-fixes'
gitster Jul 17, 2026
e47f7de
Merge branch 'jk/hash-algo-leak-fixes'
gitster Jul 17, 2026
347fe8a
Merge branch 'js/coverity-fixes'
gitster Jul 17, 2026
70ef593
Merge branch 'js/ci-dockerized-pid-limit'
gitster Jul 17, 2026
88775e3
Merge branch 'ps/t-fixes-for-git-test-long'
gitster Jul 17, 2026
09af39f
Merge branch 'ih/precompose-flex-array'
gitster Jul 17, 2026
e7e0872
Merge branch 'jk/git-hash-cleanups'
gitster Jul 17, 2026
443fe1e
Merge branch 'mm/sideband-ansi-sgr-colon-fix'
gitster Jul 17, 2026
41365c2
The 4th batch for Git 2.56
gitster Jul 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ jobs:
CI_JOB_IMAGE: ${{matrix.vector.image}}
CUSTOM_PATH: /custom
runs-on: ubuntu-latest
container: ${{matrix.vector.image}}
container:
image: ${{ matrix.vector.image }}
options: ${{ github.repository_visibility == 'private' && '--pids-limit 16384 --ulimit nproc=16384:16384 --ulimit nofile=32768:32768' || '' }}
steps:
- name: prepare libc6 for actions
if: matrix.vector.jobname == 'linux32'
Expand Down
13 changes: 7 additions & 6 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,8 @@ test:osx:
tags:
- saas-macos-large-m2pro
variables:
TEST_OUTPUT_DIRECTORY: "/Volumes/RAMDisk"
TEST_OUTPUT_DIRECTORY: "/tmp/test-output"
before_script:
# Create a 4GB RAM disk that we use to store test output on. This small hack
# significantly speeds up tests by more than a factor of 2 because the
# macOS runners use network-attached storage as disks, which is _really_
# slow with the many small writes that our tests do.
- sudo diskutil apfs create $(hdiutil attach -nomount ram://8192000) RAMDisk
- ./ci/install-dependencies.sh
script:
- ./ci/run-build-and-tests.sh
Expand Down Expand Up @@ -152,6 +147,9 @@ test:mingw64:
needs:
- job: "build:mingw64"
artifacts: true
variables:
# Windows runners don't have enough RAM to run EXPENSIVE tests.
GIT_TEST_LONG: false
before_script:
- *windows_before_script
- git-sdk/usr/bin/bash.exe -l -c 'tar xf artifacts/artifacts.tar.gz'
Expand Down Expand Up @@ -200,6 +198,9 @@ test:msvc-meson:
script:
- |
& "C:/Program Files/Git/usr/bin/bash.exe" -l -c 'ci/run-test-slice-meson.sh build $CI_NODE_INDEX $CI_NODE_TOTAL'
variables:
# Windows runners don't have enough RAM to run EXPENSIVE tests.
GIT_TEST_LONG: false
after_script:
- |
if ($env:CI_JOB_STATUS -ne "success") {
Expand Down
46 changes: 46 additions & 0 deletions Documentation/RelNotes/2.56.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,49 @@ Fixes since v2.55
when running tests with the 'GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1'
environment variable have been plugged.
(merge 459088ec2e jk/bloom-leak-fixes later to maint).

* The wincred credential helper has been updated to avoid memory
corruption when erasing credentials and to prevent silent
credential loss when storing OAuth tokens, by correcting buffer
allocations and arguments passed to safe-CRT APIs.
(merge f635ab9ab4 js/wincred-fixes later to maint).

* Various code paths that initialize a cryptographic hash context but
bail out or finish without calling 'git_hash_final()' have been taught
to call 'git_hash_discard()' to release allocated resources, fixing
memory leaks when Git is built with non-default backends like
'OpenSSL' or 'libgcrypt'.
(merge 600588d2aa jk/hash-algo-leak-fixes later to maint).

* Various resource leaks, invalid file descriptor closures, and process
handle ownership issues flagged by Coverity have been fixed.
(merge 9184231173 js/coverity-fixes later to maint).

* Dockerized CI jobs running in private GitHub repositories have been
adjusted to use explicit process and file limits, preventing resource
exhaustion errors on private runners.
(merge bad766fbac js/ci-dockerized-pid-limit later to maint).

* Various test scripts have been updated to clean up large temporary
files and repositories, reducing peak disk usage during testing.
Also, expensive tests have been disabled on platforms that lack
sufficient resources (like 32-bit platforms and Windows CI runners),
and the long test suite has been enabled in GitLab CI.
(merge 84248444ad ps/t-fixes-for-git-test-long later to maint).

* The UTF-8 precomposition wrapper on macOS has been updated to use a
flexible array member to represent the name of a directory entry,
preventing fortified libc checks from failing when the name is
reallocated to be larger than 'NAME_MAX' bytes.
(merge 1eb281159f ih/precompose-flex-array later to maint).

* The 'git_hash_*()' wrappers have been updated to be used consistently
across the codebase instead of direct calls to members of 'struct
git_hash_algo', and 'git_hash_discard()' has been made idempotent to
simplify cleanups.
(merge 9e396aa553 jk/git-hash-cleanups later to maint).

* The sideband demultiplexer has been updated to recognize ANSI SGR
escape sequences that use colon-separated subfields (e.g., for
256-color or true-color codes).
(merge 3792b2aea4 mm/sideband-ansi-sgr-colon-fix later to maint).
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build status](https://github.com/git/git/workflows/CI/badge.svg)](https://github.com/git/git/actions?query=branch%3Amaster+event%3Apush)
[![GitHub build status](https://github.com/git/git/workflows/CI/badge.svg)](https://github.com/git/git/actions?query=branch%3Amaster+event%3Apush)
[![GitLab build status](https://gitlab.com/git-scm/git/badges/master/pipeline.svg)](https://gitlab.com/git-scm/git/-/pipelines?ref=master)

Git - fast, scalable, distributed revision control system
=========================================================
Expand Down
5 changes: 3 additions & 2 deletions builtin/fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ static int store_object(

hdrlen = format_object_header((char *)hdr, sizeof(hdr), type,
dat->len);
the_hash_algo->init_fn(&c);
git_hash_init(&c, the_hash_algo);
git_hash_update(&c, hdr, hdrlen);
git_hash_update(&c, dat->buf, dat->len);
git_hash_final_oid(&oid, &c);
Expand Down Expand Up @@ -1131,7 +1131,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)

hdrlen = format_object_header((char *)out_buf, out_sz, OBJ_BLOB, len);

the_hash_algo->init_fn(&c);
git_hash_init(&c, the_hash_algo);
git_hash_update(&c, out_buf, hdrlen);

crc32_begin(pack_file);
Expand Down Expand Up @@ -1216,6 +1216,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
out:
free(in_buf);
free(out_buf);
hashfile_checkpoint_release(&checkpoint);
}

/* All calls must be guarded by find_object() or find_mark() to
Expand Down
2 changes: 2 additions & 0 deletions builtin/fsmonitor--daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,8 @@ static int fsmonitor_run_daemon(void)
err = fsmonitor_run_daemon_1(&state);

done:
fsmonitor_free_token_data(state.current_token_data);
state.current_token_data = NULL;
pthread_cond_destroy(&state.cookies_cond);
pthread_mutex_destroy(&state.main_lock);
{
Expand Down
6 changes: 3 additions & 3 deletions builtin/index-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ static const char *open_pack_file(const char *pack_name)
output_fd = -1;
nothread_data.pack_fd = input_fd;
}
the_hash_algo->init_fn(&input_ctx);
git_hash_init(&input_ctx, the_hash_algo);
return pack_name;
}

Expand Down Expand Up @@ -481,7 +481,7 @@ static void *unpack_entry_data(off_t offset, size_t size,

if (!is_delta_type(type)) {
hdrlen = format_object_header(hdr, sizeof(hdr), type, size);
the_hash_algo->init_fn(&c);
git_hash_init(&c, the_hash_algo);
git_hash_update(&c, hdr, hdrlen);
} else
oid = NULL;
Expand Down Expand Up @@ -1291,7 +1291,7 @@ static void parse_pack_objects(unsigned char *hash)

/* Check pack integrity */
flush();
the_hash_algo->init_fn(&tmp_ctx);
git_hash_init(&tmp_ctx, the_hash_algo);
git_hash_clone(&tmp_ctx, &input_ctx);
git_hash_final(hash, &tmp_ctx);
if (!hasheq(fill(the_hash_algo->rawsz), hash, the_repository->hash_algo))
Expand Down
3 changes: 2 additions & 1 deletion builtin/patch-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
char pre_oid_str[GIT_MAX_HEXSZ + 1], post_oid_str[GIT_MAX_HEXSZ + 1];
struct git_hash_ctx ctx;

the_hash_algo->init_fn(&ctx);
git_hash_init(&ctx, the_hash_algo);
oidclr(result, the_repository->hash_algo);

while (strbuf_getwholeline(line_buf, stdin, '\n') != EOF) {
Expand Down Expand Up @@ -173,6 +173,7 @@ static size_t get_one_patchid(struct object_id *next_oid, struct object_id *resu
oidclr(next_oid, the_repository->hash_algo);

flush_one_hunk(result, &ctx);
git_hash_discard(&ctx);

return patchlen;
}
Expand Down
6 changes: 3 additions & 3 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ static void hmac_hash(unsigned char *out,
/* RFC 2104 2. (1) */
memset(key, '\0', GIT_MAX_BLKSZ);
if (the_hash_algo->blksz < key_len) {
the_hash_algo->init_fn(&ctx);
git_hash_init(&ctx, the_hash_algo);
git_hash_update(&ctx, key_in, key_len);
git_hash_final(key, &ctx);
} else {
Expand All @@ -629,13 +629,13 @@ static void hmac_hash(unsigned char *out,
}

/* RFC 2104 2. (3) & (4) */
the_hash_algo->init_fn(&ctx);
git_hash_init(&ctx, the_hash_algo);
git_hash_update(&ctx, k_ipad, sizeof(k_ipad));
git_hash_update(&ctx, text, text_len);
git_hash_final(out, &ctx);

/* RFC 2104 2. (6) & (7) */
the_hash_algo->init_fn(&ctx);
git_hash_init(&ctx, the_hash_algo);
git_hash_update(&ctx, k_opad, sizeof(k_opad));
git_hash_update(&ctx, out, the_hash_algo->rawsz);
git_hash_final(out, &ctx);
Expand Down
10 changes: 5 additions & 5 deletions builtin/submodule--helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ static void create_default_gitdir_config(const char *submodule_name)

/* Case 2.4: If all the above failed, try a hash of the name as a last resort */
header_len = snprintf(header, sizeof(header), "blob %zu", strlen(submodule_name));
the_hash_algo->init_fn(&ctx);
the_hash_algo->update_fn(&ctx, header, header_len);
the_hash_algo->update_fn(&ctx, "\0", 1);
the_hash_algo->update_fn(&ctx, submodule_name, strlen(submodule_name));
the_hash_algo->final_fn(raw_name_hash, &ctx);
git_hash_init(&ctx, the_hash_algo);
git_hash_update(&ctx, header, header_len);
git_hash_update(&ctx, "\0", 1);
git_hash_update(&ctx, submodule_name, strlen(submodule_name));
git_hash_final(raw_name_hash, &ctx);
hash_to_hex_algop_r(hex_name_hash, raw_name_hash, the_hash_algo);
strbuf_reset(&gitdir_path);
repo_git_path_append(the_repository, &gitdir_path, "modules/%s", hex_name_hash);
Expand Down
4 changes: 2 additions & 2 deletions builtin/unpack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,10 @@ int cmd_unpack_objects(int argc,
/* We don't take any non-flag arguments now.. Maybe some day */
usage(unpack_usage);
}
the_hash_algo->init_fn(&ctx);
git_hash_init(&ctx, the_hash_algo);
unpack_all();
git_hash_update(&ctx, buffer, offset);
the_hash_algo->init_fn(&tmp_ctx);
git_hash_init(&tmp_ctx, the_hash_algo);
git_hash_clone(&tmp_ctx, &ctx);
git_hash_final_oid(&oid, &tmp_ctx);
if (strict) {
Expand Down
7 changes: 5 additions & 2 deletions builtin/worktree.c
Original file line number Diff line number Diff line change
Expand Up @@ -945,14 +945,17 @@ static int add(int ac, const char **av, const char *prefix,
strvec_push(&cp.args, branch);
if (opt_track)
strvec_push(&cp.args, opt_track);
if (run_command(&cp))
return -1;
if (run_command(&cp)) {
ret = -1;
goto cleanup;
}
branch = new_branch;
} else if (opt_track) {
die(_("--[no-]track can only be used if a new branch is created"));
}

ret = add_worktree(path, branch, &opts);
cleanup:
free(path);
free(opt_track);
free(branch_to_free);
Expand Down
2 changes: 1 addition & 1 deletion bundle-uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static int download_https_uri_to_file(const char *file, const char *uri)
if (child_in)
fclose(child_in);
if (finish_command(&cp))
return 1;
result = 1;
if (child_out)
fclose(child_out);
return result;
Expand Down
12 changes: 10 additions & 2 deletions ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ then
test macos != "$CI_OS_NAME" || CI_OS_NAME=osx
CI_REPO_SLUG="$GITHUB_REPOSITORY"
CI_JOB_ID="$GITHUB_RUN_ID"
CI_EVENT="$GITHUB_EVENT_NAME"
CC="${CC_PACKAGE:-${CC:-gcc}}"
DONT_SKIP_TAGS=t
handle_failed_tests () {
Expand All @@ -239,6 +240,13 @@ then
CI_BRANCH="$CI_COMMIT_REF_NAME"
CI_COMMIT="$CI_COMMIT_SHA"

case "$CI_PIPELINE_SOURCE" in
merge_request_event)
CI_EVENT=pull_request;;
*)
CI_EVENT="$CI_PIPELINE_SOURCE";;
esac

case "$OS,$CI_JOB_IMAGE" in
Windows_NT,*)
CI_OS_NAME=windows
Expand Down Expand Up @@ -319,9 +327,9 @@ export SKIP_DASHED_BUILT_INS=YesPlease
# enable "expensive" tests for PR events.
# In order to catch bugs introduced at integration time by mismerges,
# enable the long tests for pushes to the integration branches as well.
case "$GITHUB_EVENT_NAME,$CI_BRANCH" in
case "$CI_EVENT,$CI_BRANCH" in
pull_request,*|push,*next*|push,*master*|push,*main*|push,*maint*)
export GIT_TEST_LONG=YesPlease
export GIT_TEST_LONG=${GIT_TEST_LONG:-true}
;;
esac

Expand Down
4 changes: 1 addition & 3 deletions compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,10 +2269,8 @@ int mingw_kill(pid_t pid, int sig)
}
ret = terminate_process_tree(h, 128 + sig);
}
if (ret) {
if (ret)
errno = err_win_to_posix(GetLastError());
CloseHandle(h);
}
return ret;
} else if (pid > 0 && sig == 0) {
HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
Expand Down
12 changes: 8 additions & 4 deletions compat/precompose_utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ typedef char *iconv_ibp;
static const char *repo_encoding = "UTF-8";
static const char *path_encoding = "UTF-8-MAC";

static size_t dirent_prec_psx_size(size_t max_name_len)
{
return st_add(offsetof(dirent_prec_psx, d_name), max_name_len);
}

static size_t has_non_ascii(const char *s, size_t maxlen, size_t *strlen_c)
{
const uint8_t *ptr = (const uint8_t *)s;
Expand Down Expand Up @@ -114,8 +119,8 @@ const char *precompose_argv_prefix(int argc, const char **argv, const char *pref
PREC_DIR *precompose_utf8_opendir(const char *dirname)
{
PREC_DIR *prec_dir = xmalloc(sizeof(PREC_DIR));
prec_dir->dirent_nfc = xmalloc(sizeof(dirent_prec_psx));
prec_dir->dirent_nfc->max_name_len = sizeof(prec_dir->dirent_nfc->d_name);
prec_dir->dirent_nfc = xmalloc(dirent_prec_psx_size(NAME_MAX + 1));
prec_dir->dirent_nfc->max_name_len = NAME_MAX + 1;

prec_dir->dirp = opendir(dirname);
if (!prec_dir->dirp) {
Expand Down Expand Up @@ -145,8 +150,7 @@ struct dirent_prec_psx *precompose_utf8_readdir(PREC_DIR *prec_dir)
int ret_errno = errno;

if (new_maxlen > prec_dir->dirent_nfc->max_name_len) {
size_t new_len = sizeof(dirent_prec_psx) + new_maxlen -
sizeof(prec_dir->dirent_nfc->d_name);
size_t new_len = dirent_prec_psx_size(new_maxlen);

prec_dir->dirent_nfc = xrealloc(prec_dir->dirent_nfc, new_len);
prec_dir->dirent_nfc->max_name_len = new_maxlen;
Expand Down
9 changes: 5 additions & 4 deletions compat/precompose_utf8.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ typedef struct dirent_prec_psx {

/*
* See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html
* NAME_MAX + 1 should be enough, but some systems have
* NAME_MAX=255 and strlen(d_name) may return 508 or 510
* Solution: allocate more when needed, see precompose_utf8_readdir()
* Start with room for NAME_MAX + 1 bytes, but keep d_name as a
* flexible array. Some systems have NAME_MAX=255 while strlen(d_name)
* from readdir() may return 508 or 510 bytes. Grow the allocation as
* needed in precompose_utf8_readdir().
*/
char d_name[NAME_MAX+1];
char d_name[FLEX_ARRAY];
} dirent_prec_psx;


Expand Down
1 change: 1 addition & 0 deletions compat/win32/exit-process.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ static int exit_process(HANDLE process, int exit_code)
return terminate_process_tree(process, exit_code);
}

CloseHandle(process);
return 0;
}

Expand Down
12 changes: 6 additions & 6 deletions contrib/credential/wincred/git-credential-wincred.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ static int match_part_last(LPCWSTR *ptarget, LPCWSTR want, LPCWSTR delim)

static int match_cred_password(const CREDENTIALW *cred) {
int ret;
WCHAR *cred_password = xmalloc(cred->CredentialBlobSize);
wcsncpy_s(cred_password, cred->CredentialBlobSize,
(LPCWSTR)cred->CredentialBlob,
cred->CredentialBlobSize / sizeof(WCHAR));
size_t wlen = cred->CredentialBlobSize / sizeof(WCHAR);
WCHAR *cred_password = xmalloc((wlen + 1) * sizeof(WCHAR));
wcsncpy_s(cred_password, wlen + 1,
(LPCWSTR)cred->CredentialBlob, wlen);
ret = !wcscmp(cred_password, password);
free(cred_password);
return ret;
Expand Down Expand Up @@ -208,8 +208,8 @@ static void store_credential(void)

if (oauth_refresh_token) {
wlen = _scwprintf(L"%s\r\noauth_refresh_token=%s", password, oauth_refresh_token);
secret = xmalloc(sizeof(WCHAR) * wlen);
_snwprintf_s(secret, sizeof(WCHAR) * wlen, wlen, L"%s\r\noauth_refresh_token=%s", password, oauth_refresh_token);
secret = xmalloc((wlen + 1) * sizeof(WCHAR));
_snwprintf_s(secret, wlen + 1, wlen, L"%s\r\noauth_refresh_token=%s", password, oauth_refresh_token);
} else {
secret = _wcsdup(password);
}
Expand Down
Loading