Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Hi, there.

There is a segmentation fault caused by invalid memory write in gf_user_credentials_register, downloader.c:1249 with commit  6c7e0564303fa1690a744ad51a6b473564ea6d1a, which could lead to arbitrary memory access and code execution. 

Here is my environment, compiler info and gpac version:
~~~~
Distributor ID:	Ubuntu
Description:	20.04.6 LTS
Compiler: Clang 14.0.1

MP4Box - GPAC version 2.3-DEV-rev543-g6c7e05643-master
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
	GPAC Filters: https://doi.org/10.1145/3339825.3394929
	GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: --enable-sanitizer --enable-debug --disable-opt
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_JP2 GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D 
~~~~

To reproduce, run
~~~~
./MP4Box -info  -out /dev/null  poc
~~~~

POC:

[poc.zip](https://github.com/gpac/gpac/files/12818215/mp4box-overwrite-credregist1249.zip)
(unzip first)

Here is the trace reported by asan:
~~~~
==1471351==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d00001cac8 at pc 0x7f0ca5b0d16d bp 0x7ffe54904230 sp 0x7ffe549039d8
 WRITE of size 4087 at 0x61d00001cac8 thread T0
     #0 0x7f0ca5b0d16c in __interceptor_strcpy ../../../../src/libsanitizer/asan/asan_interceptors.cc:431
     #1 0x7f0c9e628301 in gf_user_credentials_register  /benchmark/gpac/src/utils/downloader.c:1249
     #2 0x7f0c9e638ab1 in gf_dm_sess_setup_from_url  /benchmark/gpac/src/utils/downloader.c:2691
     #3 0x7f0c9e63c8e8 in gf_dm_sess_new_internal  /benchmark/gpac/src/utils/downloader.c:2911
     #4 0x7f0c9e63d201 in gf_dm_sess_new_simple  /benchmark/gpac/src/utils/downloader.c:3028
     #5 0x7f0c9e63d3c3 in gf_dm_sess_new  /benchmark/gpac/src/utils/downloader.c:3047
     #6 0x7f0ca0263f2b in httpin_initialize  /benchmark/gpac/src/filters/in_http.c:143
     #7 0x7f0c9fe3f6ac in gf_filter_new_finalize  /benchmark/gpac/src/filter_core/filter.c:543
     #8 0x7f0c9fe3dfc3 in gf_filter_new  /benchmark/gpac/src/filter_core/filter.c:468
     #9 0x7f0c9fe24c56 in gf_fs_load_source_dest_internal  /benchmark/gpac/src/filter_core/filter_session.c:3513
     #10 0x7f0c9fe7bb8a in gf_filter_connect_source  /benchmark/gpac/src/filter_core/filter.c:4007
     #11 0x7f0ca01f07a4 in filelist_load_next  /benchmark/gpac/src/filters/filelist.c:1360
     #12 0x7f0ca01fcadf in filelist_process  /benchmark/gpac/src/filters/filelist.c:1949
     #13 0x7f0c9fe68e3f in gf_filter_process_task  /benchmark/gpac/src/filter_core/filter.c:2971
     #14 0x7f0c9fe1046b in gf_fs_thread_proc  /benchmark/gpac/src/filter_core/filter_session.c:2070
     #15 0x7f0c9fe13b72 in gf_fs_run  /benchmark/gpac/src/filter_core/filter_session.c:2370
     #16 0x7f0c9f3f7ae4 in gf_media_import  /benchmark/gpac/src/media_tools/media_import.c:1239
     #17 0x557f81ad2c7f in convert_file_info  /benchmark/gpac/applications/mp4box/fileimport.c:130
     #18 0x557f81a8969b in mp4box_main  /benchmark/gpac/applications/mp4box/mp4box.c:6380
     #19 0x557f81a8c3c4 in main  /benchmark/gpac/applications/mp4box/mp4box.c:6939
     #20 0x7f0c9a515082 in __libc_start_main ../csu/libc-start.c:308
     #21 0x557f81a49d4d in _start ( /benchmark/gpac/build-t/bin/gcc/MP4Box+0x107d4d)
 
 0x61d00001cac8 is located 0 bytes to the right of 2120-byte region [0x61d00001c280,0x61d00001cac8)
 allocated by thread T0 here:
     #0 0x7f0ca5b7e808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
     #1 0x7f0c9e55334a in gf_malloc  /benchmark/gpac/src/utils/alloc.c:150
     #2 0x7f0c9e627f8d in gf_user_credentials_register  /benchmark/gpac/src/utils/downloader.c:1239
     #3 0x7f0c9e638ab1 in gf_dm_sess_setup_from_url  /benchmark/gpac/src/utils/downloader.c:2691
     #4 0x7f0c9e63c8e8 in gf_dm_sess_new_internal  /benchmark/gpac/src/utils/downloader.c:2911
     #5 0x7f0c9e63d201 in gf_dm_sess_new_simple  /benchmark/gpac/src/utils/downloader.c:3028
     #6 0x7f0c9e63d3c3 in gf_dm_sess_new  /benchmark/gpac/src/utils/downloader.c:3047
     #7 0x7f0ca0263f2b in httpin_initialize  /benchmark/gpac/src/filters/in_http.c:143
     #8 0x7f0c9fe3f6ac in gf_filter_new_finalize  /benchmark/gpac/src/filter_core/filter.c:543
     #9 0x7f0c9fe3dfc3 in gf_filter_new  /benchmark/gpac/src/filter_core/filter.c:468
     #10 0x7f0c9fe24c56 in gf_fs_load_source_dest_internal  /benchmark/gpac/src/filter_core/filter_session.c:3513
     #11 0x7f0c9fe7bb8a in gf_filter_connect_source  /benchmark/gpac/src/filter_core/filter.c:4007
     #12 0x7f0ca01f07a4 in filelist_load_next  /benchmark/gpac/src/filters/filelist.c:1360
     #13 0x7f0ca01fcadf in filelist_process  /benchmark/gpac/src/filters/filelist.c:1949
     #14 0x7f0c9fe68e3f in gf_filter_process_task  /benchmark/gpac/src/filter_core/filter.c:2971
     #15 0x7f0c9fe1046b in gf_fs_thread_proc  /benchmark/gpac/src/filter_core/filter_session.c:2070
     #16 0x7f0c9fe13b72 in gf_fs_run  /benchmark/gpac/src/filter_core/filter_session.c:2370
     #17 0x7f0c9f3f7ae4 in gf_media_import  /benchmark/gpac/src/media_tools/media_import.c:1239
     #18 0x557f81ad2c7f in convert_file_info  /benchmark/gpac/applications/mp4box/fileimport.c:130
     #19 0x557f81a8969b in mp4box_main  /benchmark/gpac/applications/mp4box/mp4box.c:6380
     #20 0x557f81a8c3c4 in main  /benchmark/gpac/applications/mp4box/mp4box.c:6939
     #21 0x7f0c9a515082 in __libc_start_main ../csu/libc-start.c:308
 
 SUMMARY: AddressSanitizer: heap-buffer-overflow ../../../../src/libsanitizer/asan/asan_interceptors.cc:431 in __interceptor_strcpy
 Shadow bytes around the buggy address:
   0x0c3a7fffb900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 =>0x0c3a7fffb950: 00 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa
   0x0c3a7fffb960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb990: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb9a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
 Shadow byte legend (one shadow byte represents 8 application bytes):
   Addressable:           00
   Partially addressable: 01 02 03 04 05 06 07 
   Heap left redzone:       fa
   Freed heap region:       fd
   Stack left redzone:      f1
   Stack mid redzone:       f2
   Stack right redzone:     f3
   Stack after return:      f5
   Stack use after scope:   f8
   Global redzone:          f9
   Global init order:       f6
   Poisoned by user:        f7
   Container overflow:      fc
   Array cookie:            ac
   Intra object redzone:    bb
   ASan internal:           fe
   Left alloca redzone:     ca
   Right alloca redzone:    cb
   Shadow gap:              cc
 ==1471351==ABORTING

~~~~


Segmentation fault caused by heap buffer overflow in gf_user_credentials_register, downloader.c:1249
This is a GitHub Issue
repo:gpac
owner:gpac
Title : Segmentation fault caused by heap buffer overflow in gf_user_credentials_register, downloader.c:1249
Issue date:

--- start body ---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Hi, there.

There is a segmentation fault caused by invalid memory write in gf_user_credentials_register, downloader.c:1249 with commit  6c7e0564303fa1690a744ad51a6b473564ea6d1a, which could lead to arbitrary memory access and code execution. 

Here is my environment, compiler info and gpac version:
~~~~
Distributor ID:	Ubuntu
Description:	20.04.6 LTS
Compiler: Clang 14.0.1

MP4Box - GPAC version 2.3-DEV-rev543-g6c7e05643-master
(c) 2000-2023 Telecom Paris distributed under LGPL v2.1+ - http://gpac.io

Please cite our work in your research:
	GPAC Filters: https://doi.org/10.1145/3339825.3394929
	GPAC: https://doi.org/10.1145/1291233.1291452

GPAC Configuration: --enable-sanitizer --enable-debug --disable-opt
Features: GPAC_CONFIG_LINUX GPAC_64_BITS GPAC_HAS_IPV6 GPAC_HAS_SSL GPAC_HAS_SOCK_UN GPAC_MINIMAL_ODF GPAC_HAS_QJS GPAC_HAS_JPEG GPAC_HAS_PNG GPAC_HAS_JP2 GPAC_HAS_VORBIS GPAC_HAS_LINUX_DVB  GPAC_DISABLE_3D 
~~~~

To reproduce, run
~~~~
./MP4Box -info  -out /dev/null  poc
~~~~

POC:

[poc.zip](https://github.com/gpac/gpac/files/12818215/mp4box-overwrite-credregist1249.zip)
(unzip first)

Here is the trace reported by asan:
~~~~
==1471351==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d00001cac8 at pc 0x7f0ca5b0d16d bp 0x7ffe54904230 sp 0x7ffe549039d8
 WRITE of size 4087 at 0x61d00001cac8 thread T0
     #0 0x7f0ca5b0d16c in __interceptor_strcpy ../../../../src/libsanitizer/asan/asan_interceptors.cc:431
     #1 0x7f0c9e628301 in gf_user_credentials_register  /benchmark/gpac/src/utils/downloader.c:1249
     #2 0x7f0c9e638ab1 in gf_dm_sess_setup_from_url  /benchmark/gpac/src/utils/downloader.c:2691
     #3 0x7f0c9e63c8e8 in gf_dm_sess_new_internal  /benchmark/gpac/src/utils/downloader.c:2911
     #4 0x7f0c9e63d201 in gf_dm_sess_new_simple  /benchmark/gpac/src/utils/downloader.c:3028
     #5 0x7f0c9e63d3c3 in gf_dm_sess_new  /benchmark/gpac/src/utils/downloader.c:3047
     #6 0x7f0ca0263f2b in httpin_initialize  /benchmark/gpac/src/filters/in_http.c:143
     #7 0x7f0c9fe3f6ac in gf_filter_new_finalize  /benchmark/gpac/src/filter_core/filter.c:543
     #8 0x7f0c9fe3dfc3 in gf_filter_new  /benchmark/gpac/src/filter_core/filter.c:468
     #9 0x7f0c9fe24c56 in gf_fs_load_source_dest_internal  /benchmark/gpac/src/filter_core/filter_session.c:3513
     #10 0x7f0c9fe7bb8a in gf_filter_connect_source  /benchmark/gpac/src/filter_core/filter.c:4007
     #11 0x7f0ca01f07a4 in filelist_load_next  /benchmark/gpac/src/filters/filelist.c:1360
     #12 0x7f0ca01fcadf in filelist_process  /benchmark/gpac/src/filters/filelist.c:1949
     #13 0x7f0c9fe68e3f in gf_filter_process_task  /benchmark/gpac/src/filter_core/filter.c:2971
     #14 0x7f0c9fe1046b in gf_fs_thread_proc  /benchmark/gpac/src/filter_core/filter_session.c:2070
     #15 0x7f0c9fe13b72 in gf_fs_run  /benchmark/gpac/src/filter_core/filter_session.c:2370
     #16 0x7f0c9f3f7ae4 in gf_media_import  /benchmark/gpac/src/media_tools/media_import.c:1239
     #17 0x557f81ad2c7f in convert_file_info  /benchmark/gpac/applications/mp4box/fileimport.c:130
     #18 0x557f81a8969b in mp4box_main  /benchmark/gpac/applications/mp4box/mp4box.c:6380
     #19 0x557f81a8c3c4 in main  /benchmark/gpac/applications/mp4box/mp4box.c:6939
     #20 0x7f0c9a515082 in __libc_start_main ../csu/libc-start.c:308
     #21 0x557f81a49d4d in _start ( /benchmark/gpac/build-t/bin/gcc/MP4Box+0x107d4d)
 
 0x61d00001cac8 is located 0 bytes to the right of 2120-byte region [0x61d00001c280,0x61d00001cac8)
 allocated by thread T0 here:
     #0 0x7f0ca5b7e808 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:144
     #1 0x7f0c9e55334a in gf_malloc  /benchmark/gpac/src/utils/alloc.c:150
     #2 0x7f0c9e627f8d in gf_user_credentials_register  /benchmark/gpac/src/utils/downloader.c:1239
     #3 0x7f0c9e638ab1 in gf_dm_sess_setup_from_url  /benchmark/gpac/src/utils/downloader.c:2691
     #4 0x7f0c9e63c8e8 in gf_dm_sess_new_internal  /benchmark/gpac/src/utils/downloader.c:2911
     #5 0x7f0c9e63d201 in gf_dm_sess_new_simple  /benchmark/gpac/src/utils/downloader.c:3028
     #6 0x7f0c9e63d3c3 in gf_dm_sess_new  /benchmark/gpac/src/utils/downloader.c:3047
     #7 0x7f0ca0263f2b in httpin_initialize  /benchmark/gpac/src/filters/in_http.c:143
     #8 0x7f0c9fe3f6ac in gf_filter_new_finalize  /benchmark/gpac/src/filter_core/filter.c:543
     #9 0x7f0c9fe3dfc3 in gf_filter_new  /benchmark/gpac/src/filter_core/filter.c:468
     #10 0x7f0c9fe24c56 in gf_fs_load_source_dest_internal  /benchmark/gpac/src/filter_core/filter_session.c:3513
     #11 0x7f0c9fe7bb8a in gf_filter_connect_source  /benchmark/gpac/src/filter_core/filter.c:4007
     #12 0x7f0ca01f07a4 in filelist_load_next  /benchmark/gpac/src/filters/filelist.c:1360
     #13 0x7f0ca01fcadf in filelist_process  /benchmark/gpac/src/filters/filelist.c:1949
     #14 0x7f0c9fe68e3f in gf_filter_process_task  /benchmark/gpac/src/filter_core/filter.c:2971
     #15 0x7f0c9fe1046b in gf_fs_thread_proc  /benchmark/gpac/src/filter_core/filter_session.c:2070
     #16 0x7f0c9fe13b72 in gf_fs_run  /benchmark/gpac/src/filter_core/filter_session.c:2370
     #17 0x7f0c9f3f7ae4 in gf_media_import  /benchmark/gpac/src/media_tools/media_import.c:1239
     #18 0x557f81ad2c7f in convert_file_info  /benchmark/gpac/applications/mp4box/fileimport.c:130
     #19 0x557f81a8969b in mp4box_main  /benchmark/gpac/applications/mp4box/mp4box.c:6380
     #20 0x557f81a8c3c4 in main  /benchmark/gpac/applications/mp4box/mp4box.c:6939
     #21 0x7f0c9a515082 in __libc_start_main ../csu/libc-start.c:308
 
 SUMMARY: AddressSanitizer: heap-buffer-overflow ../../../../src/libsanitizer/asan/asan_interceptors.cc:431 in __interceptor_strcpy
 Shadow bytes around the buggy address:
   0x0c3a7fffb900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   0x0c3a7fffb940: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 =>0x0c3a7fffb950: 00 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa
   0x0c3a7fffb960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb990: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
   0x0c3a7fffb9a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
 Shadow byte legend (one shadow byte represents 8 application bytes):
   Addressable:           00
   Partially addressable: 01 02 03 04 05 06 07 
   Heap left redzone:       fa
   Freed heap region:       fd
   Stack left redzone:      f1
   Stack mid redzone:       f2
   Stack right redzone:     f3
   Stack after return:      f5
   Stack use after scope:   f8
   Global redzone:          f9
   Global init order:       f6
   Poisoned by user:        f7
   Container overflow:      fc
   Array cookie:            ac
   Intra object redzone:    bb
   ASan internal:           fe
   Left alloca redzone:     ca
   Right alloca redzone:    cb
   Shadow gap:              cc
 ==1471351==ABORTING

~~~~


--- end body ---
