1
0
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:
Sebastien Helleu
2011-01-21 19:30:08 +01:00
parent 1ca2261e95
commit cc6bb607e0
6 changed files with 85 additions and 40 deletions
+5 -2
View File
@@ -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;
}
/*