1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 20:36:38 +02:00

Revert "core, plugins: replace "%lx" by "%p" in calls to sscanf"

This reverts commit e64ab3c675.

This was causing incorrect conversion of strings "0x..." to pointers on systems
like Solaris/illumos.

And as a side effect, buffers were sometimes empty in weechat relay clients
like glowing-bear.
This commit is contained in:
Sébastien Helleu
2025-05-15 19:23:15 +02:00
parent 9783256649
commit d0c00f7db2
21 changed files with 91 additions and 63 deletions
+3 -3
View File
@@ -407,7 +407,7 @@ plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
const char *script_name, const char *function_name,
const char *str_pointer)
{
void *pointer;
unsigned long value;
int rc;
struct t_gui_buffer *ptr_buffer;
@@ -417,9 +417,9 @@ plugin_script_str2ptr (struct t_weechat_plugin *weechat_plugin,
if ((str_pointer[0] != '0') || (str_pointer[1] != 'x'))
goto invalid;
rc = sscanf (str_pointer, "%p", &pointer);
rc = sscanf (str_pointer + 2, "%lx", &value);
if ((rc != EOF) && (rc >= 1))
return pointer;
return (void *)value;
invalid:
if ((weechat_plugin->debug >= 1) && script_name && function_name)