summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/parseaddr.c
diff options
context:
space:
mode:
authorColin Guthrie <pulse@colin.guthr.ie>2008-08-22 10:56:45 +0100
committerColin Guthrie <pulse@colin.guthr.ie>2008-08-22 10:56:45 +0100
commit4282b726ee57ebae846ce400fd1cae43c4dfb2ae (patch)
tree2cb32c3bc52a9b9eab50a6195f3ccb190332f7d8 /src/pulsecore/parseaddr.c
parentbf17dbb101d509e885bf689f4f13f75e4b3ab58d (diff)
parentdc9b8dce309728b47059b9b44fd3bbd3798667ae (diff)
Merge branch 'master' of git://git.0pointer.de/pulseaudio
Diffstat (limited to 'src/pulsecore/parseaddr.c')
-rw-r--r--src/pulsecore/parseaddr.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/pulsecore/parseaddr.c b/src/pulsecore/parseaddr.c
index f2b6b2cf..c5cd7fe7 100644
--- a/src/pulsecore/parseaddr.c
+++ b/src/pulsecore/parseaddr.c
@@ -51,20 +51,29 @@ static char *parse_host(const char *s, uint16_t *ret_port) {
if (!(e = strchr(s+1, ']')))
return NULL;
- if (e[1] == ':')
- *ret_port = atoi(e+2);
- else if (e[1] != 0)
+ if (e[1] == ':') {
+ uint32_t p;
+
+ if (pa_atou(e+2, &p) < 0)
+ return NULL;
+
+ *ret_port = (uint16_t) p;
+ } else if (e[1] != 0)
return NULL;
- return pa_xstrndup(s+1, e-s-1);
+ return pa_xstrndup(s+1, (size_t) (e-s-1));
} else {
char *e;
+ uint32_t p;
if (!(e = strrchr(s, ':')))
return pa_xstrdup(s);
- *ret_port = atoi(e+1);
- return pa_xstrndup(s, e-s);
+ if (pa_atou(e+1, &p) < 0)
+ return NULL;
+
+ *ret_port = (uint16_t) p;
+ return pa_xstrndup(s, (size_t) (e-s));
}
}