summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-01 13:00:33 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-01 13:00:33 +0200
commite6e537524979dde434af3e0b0d5eba6d115a406c (patch)
tree68fdcd7d5e8d41246aaca48f553d098565604d05 /src
parentenable more warnings (diff)
downloadblueshift-e6e537524979dde434af3e0b0d5eba6d115a406c.tar.gz
blueshift-e6e537524979dde434af3e0b0d5eba6d115a406c.tar.bz2
blueshift-e6e537524979dde434af3e0b0d5eba6d115a406c.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/blueshift_drm_c.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/blueshift_drm_c.c b/src/blueshift_drm_c.c
index 8888146..ad6569c 100644
--- a/src/blueshift_drm_c.c
+++ b/src/blueshift_drm_c.c
@@ -76,14 +76,13 @@ void blueshift_drm_close(void)
*/
int blueshift_drm_card_count(void)
{
- long maxlen = strlen(DRM_DIR_NAME) + strlen(DRM_DEV_NAME) + 10;
- char* pathname = alloca(maxlen * sizeof(char));
+ char pathname[4096];
int count = 0;
struct stat _attr;
for (;;)
{
- sprintf(pathname, DRM_DEV_NAME, DRM_DIR_NAME, count);
+ snprintf(pathname, 4096, DRM_DEV_NAME, DRM_DIR_NAME, count);
if (stat(pathname, &_attr))
break;
count++;
@@ -101,12 +100,11 @@ int blueshift_drm_card_count(void)
*/
int blueshift_drm_open_card(int card_index)
{
- long maxlen = strlen(DRM_DIR_NAME) + strlen(DRM_DEV_NAME) + 10;
- char* pathname = alloca(maxlen * sizeof(char));
+ char pathname[4096];
int fd;
int rc;
- sprintf(pathname, DRM_DEV_NAME, DRM_DIR_NAME, card_index);
+ snprintf(pathname, 4096, DRM_DEV_NAME, DRM_DIR_NAME, card_index);
fd = open(pathname, O_RDWR | O_CLOEXEC);
if (fd < 0)