Still segfaults on read from URL.

This commit is contained in:
Simon Brooke 2019-01-28 10:32:34 +00:00
parent 3470f27585
commit 8334e2bf1f
2 changed files with 5 additions and 4 deletions

View file

@ -16,6 +16,9 @@
#include <unistd.h>
#include <wchar.h>
/* libcurl, used for io */
#include <curl/curl.h>
#include "version.h"
#include "conspage.h"
#include "consspaceobject.h"
@ -84,6 +87,7 @@ int main( int argc, char *argv[] ) {
bool show_prompt = false;
setlocale( LC_ALL, "" );
curl_global_init(CURL_GLOBAL_DEFAULT);
while ( ( option = getopt( argc, argv, "cpdv:" ) ) != -1 ) {
switch ( option ) {

View file

@ -460,14 +460,11 @@ wint_t url_fgetwc( URL_FILE * input ) {
case CFTYPE_CURL:{
wchar_t *wbuff = calloc( 2, sizeof( wchar_t ) );
char *cbuff = calloc( 5, sizeof( char ) );
url_fread( cbuff, sizeof( char ), 4, input );
mbstowcs( wbuff, cbuff, 1 );
mbstowcs( wbuff, (char *)&input->buffer[input->buffer_pos], 1 );
result = wbuff[0];
use_one_wide( input );
free( cbuff );
free( wbuff );
}
break;