Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 0 additions & 10 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ task:
only_if: $CIRRUS_BRANCH == "main" || $CIRRUS_PR != ""

matrix:
- name: macOS
macos_instance:
image: ghcr.io/cirruslabs/macos-runner:sequoia
environment:
CFLAGS: -pedantic -I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/include
LDFLAGS: -L/opt/homebrew/opt/openssl@3/lib -L/opt/homebrew/lib
PKG_CONFIG_PATH: /opt/homebrew/opt/openssl@3/lib/pkgconfig
install_script: brew update && brew install json-c libscrypt openssl python3 && env PIP_BREAK_SYSTEM_PACKAGES=1 python3 -m pip install pexpect pytest
test_script: uname -sr && python3 --version && mkdir build && cd build && cmake .. && cmake --build . && cmake --build . -- check && sudo cmake --build . -- install

- name: clang-format
container:
image: silkeh/clang:19
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ jobs:
cmake --build build --target check
cmake --install build

macos:
runs-on: macos-26-intel
env:
CFLAGS: -pedantic -Werror -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=address,undefined
UBSAN_OPTIONS: print_stacktrace=1
steps:
- run: uname -rms
- run: python3 --version
- run: brew update
- run: brew install json-c libscrypt
- run: env PIP_BREAK_SYSTEM_PACKAGES=1 python3 -m pip install pexpect pytest
- run: echo "cloning ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
- run: git clone --no-checkout -- ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} wd
- run: cd wd && git fetch -- origin ${{ github.event.pull_request.head.sha }} && git checkout FETCH_HEAD
- run: cmake -B build -S wd
- run: cmake --build build
- run: cmake --build build --target check
- run: sudo cmake --install build

ubuntu2404_nogui:
name: Ubuntu 24.04, no GTK
runs-on: ubuntu-24.04
Expand Down
14 changes: 7 additions & 7 deletions cli/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ static void hash(const char *s, char hex[static SHA_DIGEST_LENGTH * 2 + 1]) {

// convert the digest to hex digits
for (size_t i = 0; i < sizeof(digest); i++)
sprintf(&hex[i * 2], "%02X", (int)digest[i]);
snprintf(&hex[i * 2], 3, "%02X", (int)digest[i]);
}

static const char *get_ssl_error(const SSL *ssl, int ret) {
Expand Down Expand Up @@ -237,12 +237,12 @@ static char *hibp_data(const char *hex, const char **error) {
"Host: api.pwnedpasswords.com\r\n"
"User-Agent: passwand <https://github.com/Smattr/passwand>\r\n"
"\r\n")];
sprintf(buffer,
"GET /range/%.5s HTTP/1.0\r\n"
"Host: api.pwnedpasswords.com\r\n"
"User-Agent: passwand <https://github.com/Smattr/passwand>\r\n"
"\r\n",
hex);
snprintf(buffer, sizeof(buffer),
"GET /range/%.5s HTTP/1.0\r\n"
"Host: api.pwnedpasswords.com\r\n"
"User-Agent: passwand <https://github.com/Smattr/passwand>\r\n"
"\r\n",
hex);

size_t len = strlen(buffer);
size_t sent = 0;
Expand Down
14 changes: 7 additions & 7 deletions gui/osascript.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,17 +332,18 @@ int send_text(const char *text) {

const char *describe_output(void) { return "osascript"; }

void flush_state() { /* no-op for osascript */ }
void flush_state(void) { /* no-op for osascript */ }

void show_error(const char *message) {

assert(message != NULL);

bool m_needs_free = true;
char *m = escape(message);
if (m == NULL) {
char *const escaped = escape(message);
const char *m;
if (escaped == NULL) {
m = "failed to allocate escaping memory";
m_needs_free = false;
} else {
m = escaped;
}

struct iovec iov[] = {
Expand All @@ -354,8 +355,7 @@ void show_error(const char *message) {

(void)osascript(iov, sizeof(iov) / sizeof(iov[0]), NULL);

if (m_needs_free)
free(m);
free(escaped);
}

int gui_init(void) {
Expand Down
4 changes: 2 additions & 2 deletions src/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ passwand_error_t passwand_export(const char *path, passwand_entry_t *entries,
rc = PW_OVERFLOW;
goto done;
}
tmp = malloc(strlen(path) + 2);
tmp = malloc(path_len + 2);
if (tmp == NULL) {
rc = PW_NO_MEM;
goto done;
}
sprintf(tmp, "%s~", path);
snprintf(tmp, path_len + 2, "%s~", path);
int fd = open(tmp, O_CLOEXEC | O_CREAT | O_WRONLY | O_TRUNC, 0600);
if (fd == -1) {
rc = PW_IO;
Expand Down
Loading