summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/script.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-01-21 19:30:08 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-01-21 19:30:08 +0100
commitcc6bb607e09101df7769cf1ec46a9bf8a605dab0 (patch)
tree77eace769bf610fcce06ef8abe46264c92bfab4e /src/plugins/scripts/script.c
parent1ca2261e95b3f9b9dee59df5ee8fad5e8d493873 (diff)
downloadweechat-cc6bb607e09101df7769cf1ec46a9bf8a605dab0.zip
Test return value of calls to sscanf function
Diffstat (limited to 'src/plugins/scripts/script.c')
-rw-r--r--src/plugins/scripts/script.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/scripts/script.c b/src/plugins/scripts/script.c
index bcccfec89..8f36e2106 100644
--- a/src/plugins/scripts/script.c
+++ b/src/plugins/scripts/script.c
@@ -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;
}
/*