Skip to content

Commit

Permalink
Prevent compilation with buggy libcurl library
Browse files Browse the repository at this point in the history
Closes #34
  • Loading branch information
arkq committed Jul 23, 2020
1 parent ad2fd0a commit 98a3939
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 9 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# cmusfm - configure.ac
# Copyright (c) 2014-2018 Arkadiusz Bokowy
# Copyright (c) 2014-2020 Arkadiusz Bokowy

AC_PREREQ([2.59])
AC_INIT([cmusfm], [1.0.0], [[email protected]])
Expand Down Expand Up @@ -42,6 +42,14 @@ PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], [
], [#skip])

PKG_CHECK_MODULES([LIBCURL], [libcurl])
if $PKG_CONFIG --exact-version=7.71.0 libcurl; then
AC_MSG_ERROR([libcurl == 7.71.0
Because of curl_easy_escape() bug present in the curl library version 7.71.0,
cmusfm will not work correctly. Please, upgrade or downgrade the curl library.
Related curl bug report: https://github.com/curl/curl/issues/5601])
fi

# support for desktop notifications
AC_ARG_ENABLE([libnotify],
Expand Down
7 changes: 5 additions & 2 deletions src/libscrobbler2.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* libscrobbler2.c
* Copyright (c) 2011-2018 Arkadiusz Bokowy
* Copyright (c) 2011-2020 Arkadiusz Bokowy
*
* This file is a part of cmusfm.
*
Expand Down Expand Up @@ -58,8 +58,11 @@ static size_t sb_curl_write_callback(char *ptr, size_t size, size_t nmemb,

/* XXX: Passing a zero bytes data to this callback is not en error,
* however memory allocation fail is. */
if (!size || (rd->data = realloc(rd->data, rd->size + size + 1)) == NULL)
void *tmp = rd->data;
if (!size || (rd->data = realloc(rd->data, rd->size + size + 1)) == NULL) {
free(tmp);
return 0;
}

memcpy(&rd->data[rd->size], ptr, size);
rd->size += size;
Expand Down

0 comments on commit 98a3939

Please sign in to comment.