mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 20:36:38 +02:00
Test return value of calls to sscanf function
This commit is contained in:
@@ -386,13 +386,16 @@ void *
|
||||
script_str2ptr (const char *pointer_str)
|
||||
{
|
||||
long unsigned int value;
|
||||
int rc;
|
||||
|
||||
if (!pointer_str || (pointer_str[0] != '0') || (pointer_str[1] != 'x'))
|
||||
return NULL;
|
||||
|
||||
sscanf (pointer_str + 2, "%lx", &value);
|
||||
rc = sscanf (pointer_str + 2, "%lx", &value);
|
||||
if ((rc != EOF) && (rc >= 1))
|
||||
return (void *)value;
|
||||
|
||||
return (void *)value;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user