From 657a953d5d2807ed99eddf7b45a4dc46cef626d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 7 May 2008 18:23:55 +0200 Subject: 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(). --- src/input/librtsp/rtsp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/input/librtsp') diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index beb77d8b4..99f0da665 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -482,9 +482,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - s->host = malloc(sizeof(char)*hostend+1); - strncpy(s->host, mrl_ptr, hostend); - s->host[hostend]=0; + s->host = strndup(mrl_ptr, hostend); if (pathbegin < strlen(mrl_ptr)) s->path=strdup(mrl_ptr+pathbegin+1); if (colon != slash) { -- cgit v1.2.3