diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:23:55 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:23:55 +0200 |
commit | 657a953d5d2807ed99eddf7b45a4dc46cef626d5 (patch) | |
tree | f5ea31172e10ef4409409064ceb5d8898022317c /src/input/pnm.c | |
parent | bbb2643bdcc8fb3d7f29c11e1344286b042535bf (diff) | |
download | xine-lib-657a953d5d2807ed99eddf7b45a4dc46cef626d5.tar.gz xine-lib-657a953d5d2807ed99eddf7b45a4dc46cef626d5.tar.bz2 |
Use strn?dup instead of alloc + strn?cpy.
Whenever an allocated memory area is immediately filled in with a
string through strcpy() or strncpy(), replace the calls with the
appropriate strn?dup().
Diffstat (limited to 'src/input/pnm.c')
-rw-r--r-- | src/input/pnm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/input/pnm.c b/src/input/pnm.c index edd7a5d71..47a24a620 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -21,6 +21,10 @@ * based upon code from joschka */ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + #include <unistd.h> #include <stdio.h> #include <sys/socket.h> @@ -732,9 +736,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) { |