diff src/audio/SDL_audiodev.c @ 1379:c0a74f199ecf

Use only safe string functions
author Sam Lantinga <slouken@libsdl.org>
date Sun, 19 Feb 2006 23:46:34 +0000
parents c71e05b4dc2e
children d910939febfa
line wrap: on
line diff
--- a/src/audio/SDL_audiodev.c	Sun Feb 19 23:38:57 2006 +0000
+++ b/src/audio/SDL_audiodev.c	Sun Feb 19 23:46:34 2006 +0000
@@ -89,7 +89,7 @@
 		audiodev = audiopath;
 	}
 	if ( path != NULL ) {
-		SDL_strncpy(path, audiodev, maxlen);
+		SDL_strlcpy(path, audiodev, maxlen);
 		path[maxlen-1] = '\0';
 	}
 	return(audio_fd);
@@ -136,7 +136,7 @@
 	}
 	audio_fd = open(audiodev, flags, 0);
 	if ( path != NULL ) {
-		SDL_strncpy(path, audiodev, maxlen);
+		SDL_strlcpy(path, audiodev, maxlen);
 		path[maxlen-1] = '\0';
 	}
 	return audio_fd;
@@ -166,8 +166,7 @@
 	    audio_fd = open(audiopath, flags, 0);
 	    if ( audio_fd > 0 ) {
 		if ( path != NULL ) {
-		    SDL_strncpy( path, audiopath, maxlen );
-		    path[maxlen-1] = '\0';
+		    SDL_strlcpy( path, audiopath, maxlen );
 		}
 	        return audio_fd;
 	    }