Skip to content

Add version checking for Linux and macOS using CURL - #2

Open
dylanbautista wants to merge 2 commits into
openlab-x:mainfrom
dylanbautista:main
Open

Add version checking for Linux and macOS using CURL#2
dylanbautista wants to merge 2 commits into
openlab-x:mainfrom
dylanbautista:main

Conversation

@dylanbautista

Copy link
Copy Markdown

As mentioned in issue #1, the original implementation used Windows-specific calls to obtain the latest version of OCX from GitHub using the HTTPS protocol. This PR implements the same functionality using CURL, which can be compiled both for Linux and macOS.

Furthermore, in file ui/dialogs/settings_dialog.h the wxSpinCtrl type is used, but the spinctrl.h header file is never included. I've also fixed it.

These changes are sufficient to compile the project for macOS, didn't test it on Linux.

@dylanbautista
dylanbautista marked this pull request as draft July 22, 2026 14:55
@dylanbautista
dylanbautista marked this pull request as ready for review July 22, 2026 15:01
@ajee10x

ajee10x commented Jul 26, 2026

Copy link
Copy Markdown
Member

Thanks for this, appreciate the cross-platform fix and catching the missing spinctrl.h include too.

One thing to fix before this can merge, in write_callback:

size_t total = size * nmemb;
strlcat((char*)userdata, ptr, total);

The third argument to strlcat needs to be the size of the destination buffer (128, from buf[128] in OCXFetchRemoteVersion), not the size of the chunk coming in from curl. Right now it's telling strlcat "you've got total bytes of room" where total is just however much data curl handed over that call. If the response ever comes back bigger than 128 bytes in one go, this overflows the buffer. Also worth checking, ptr from curl isn't guaranteed to be null-terminated, so strlcat scanning it like a C-string could read past its bounds too.

Right now userdata is just the raw char* buf, so write_callback has no way to know its capacity, that's the actual root cause. Might be worth passing a small struct (pointer + capacity + bytes-written-so-far) as userdata instead, so the callback can enforce the limit properly.

Could you fix it so it respects the actual remaining space in buf?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants