diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-18 21:59:40 +0100 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-18 21:59:40 +0100 |
commit | 60fb61f5d503d16233b2bfed884cd7bfd9865343 (patch) | |
tree | c38d2d8b7eedc14a51878d5fe9713e9bf97ff424 | |
parent | 8420c9a0ec8eb05b30fc5e48e062b14f1af095f6 (diff) | |
download | xine-lib-60fb61f5d503d16233b2bfed884cd7bfd9865343.tar.gz xine-lib-60fb61f5d503d16233b2bfed884cd7bfd9865343.tar.bz2 |
Use strndup.
-rw-r--r-- | src/input/pnm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/input/pnm.c b/src/input/pnm.c index 38d65b850..942e52957 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -21,6 +21,8 @@ * based upon code from joschka */ +#include <config.h> + #include <unistd.h> #include <stdio.h> #include <sys/socket.h> @@ -732,9 +734,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - p->host = malloc(sizeof(char)*hostend+1); - strncpy(p->host, mrl_ptr, hostend); - p->host[hostend]=0; + p->host = strndup(mrl_ptr, hostend); if (pathbegin < strlen(mrl_ptr)) p->path=strdup(mrl_ptr+pathbegin+1); if (colon != slash) { |