diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-12 10:31:04 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-12 10:31:04 +0000 |
commit | c49ecc2c61d5c159b7fc33f63f61b389a9660569 (patch) | |
tree | c1ea0ced2361cb9b30b293fe00289d823fbc27fd /src/testbed | |
parent | 9980d7ed997ac3942fe4980b15300966f6dc7b18 (diff) | |
download | gnunet-c49ecc2c61d5c159b7fc33f63f61b389a9660569.tar.gz gnunet-c49ecc2c61d5c159b7fc33f63f61b389a9660569.zip |
no auto allocation during scanf
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 36cd5c14e..92cc0c2d6 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -298,8 +298,8 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
298 | struct GNUNET_TESTBED_Host *starting_host; | 298 | struct GNUNET_TESTBED_Host *starting_host; |
299 | char *data; | 299 | char *data; |
300 | char *buf; | 300 | char *buf; |
301 | char *username; | 301 | char username[256]; |
302 | char *hostname; | 302 | char hostname[256]; |
303 | uint64_t fs; | 303 | uint64_t fs; |
304 | short int port; | 304 | short int port; |
305 | int ret; | 305 | int ret; |
@@ -339,10 +339,8 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
339 | if (((data[offset] == '\n')) && (buf != &data[offset])) | 339 | if (((data[offset] == '\n')) && (buf != &data[offset])) |
340 | { | 340 | { |
341 | data[offset] = '\0'; | 341 | data[offset] = '\0'; |
342 | username = NULL; | 342 | ret = SSCANF (buf, "%255[a-zA-Z0-9_]@%255[a-zA-Z0-9.]:%5hd", |
343 | hostname = NULL; | 343 | username, hostname, &port); |
344 | ret = SSCANF (buf, "%m[a-zA-Z0-9_]@%m[a-zA-Z0-9.]:%hd", | ||
345 | &username, &hostname, &port); | ||
346 | if (3 == ret) | 344 | if (3 == ret) |
347 | { | 345 | { |
348 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 346 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -360,8 +358,6 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename, | |||
360 | else | 358 | else |
361 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 359 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
362 | "Error reading line `%s' in hostfile\n", buf); | 360 | "Error reading line `%s' in hostfile\n", buf); |
363 | GNUNET_free_non_null (hostname); | ||
364 | GNUNET_free_non_null (username); | ||
365 | buf = &data[offset + 1]; | 361 | buf = &data[offset + 1]; |
366 | } | 362 | } |
367 | else if ((data[offset] == '\n') || (data[offset] == '\0')) | 363 | else if ((data[offset] == '\n') || (data[offset] == '\0')) |