libc: Fix memcmp implementation
libc: Fix memcmp implementation

The previous implementation would read one byte past both buffers if
the buffers were equal. Make sure the pointers are not incremented
past the last byte. Also ensure that comparing zero bytes always
returns 0.

Change-Id: I5ef25d6bd2f7417b60102dc1c2602d8b23c4c1bc
Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>

explora26/zephyr,coldnew/zephyr-project-fork,coldnew/zephyr-project-fork,fractalclone/zephyr-riscv,jamesonwilliams/zephyr-kernel,fbsder/zephyr,rsalveti/zephyr,Vudentz/zephyr,bigdinotech/zephyr,aceofall/zephyr-iotos,32bitmicro/zephyr,fractalclone/zephyr-riscv,32bitmicro/zephyr,galak/zephyr,explora26/zephyr,sharronliu/zephyr,explora26/zephyr,bigdinotech/zephyr,erwango/zephyr,explora26/zephyr,runchip/zephyr-cc3220,aceofall/zephyr-iotos,GiulianoFranchetto/zephyr,galak/zephyr,32bitmicro/zephyr,zephyriot/zephyr,punitvara/zephyr,tidyjiang8/zephyr-doc,pklazy/zephyr,mbolivar/zephyr,mirzak/zephyr-os,runchip/zephyr-cc3200,sharronliu/zephyr,nashif/zephyr,holtmann/zephyr,aceofall/zephyr-iotos,punitvara/zephyr,ldts/zephyr,mirzak/zephyr-os,zephyriot/zephyr,bboozzoo/zephyr,holtmann/zephyr,galak/zephyr,erwango/zephyr,zephyrproject-rtos/zephyr,zephyriot/zephyr,coldnew/zephyr-project-fork,finikorg/zephyr,fbsder/zephyr,bboozzoo/zephyr,aceofall/zephyr-iotos,finikorg/zephyr,nashif/zephyr,ldts/zephyr,GiulianoFranchetto/zephyr,pklazy/zephyr,mirzak/zephyr-os,finikorg/zephyr,Vudentz/zephyr,fbsder/zephyr,pklazy/zephyr,zephyrproject-rtos/zephyr,GiulianoFranchetto/zephyr,tidyjiang8/zephyr-doc,runchip/zephyr-cc3220,tidyjiang8/zephyr-doc,nashif/zephyr,jamesonwilliams/zephyr-kernel,holtmann/zephyr,GiulianoFranchetto/zephyr,punitvara/zephyr,32bitmicro/zephyr,galak/zephyr,ldts/zephyr,Vudentz/zephyr,Vudentz/zephyr,sharronliu/zephyr,punitvara/zephyr,tidyjiang8/zephyr-doc,galak/zephyr,zephyrproject-rtos/zephyr,32bitmicro/zephyr,erwango/zephyr,zephyrproject-rtos/zephyr,bboozzoo/zephyr,jamesonwilliams/zephyr-kernel,mbolivar/zephyr,runchip/zephyr-cc3200,coldnew/zephyr-project-fork,fbsder/zephyr,bigdinotech/zephyr,bigdinotech/zephyr,jamesonwilliams/zephyr-kernel,rsalveti/zephyr,fractalclone/zephyr-riscv,zephyriot/zephyr,Vudentz/zephyr,sharronliu/zephyr,explora26/zephyr,kraj/zephyr,mirzak/zephyr-os,runchip/zephyr-cc3220,runchip/zephyr-cc3200,kraj/zephyr,ldts/zephyr,rsalveti/zephyr,erwango/zephyr,bboozzoo/zephyr,rsalveti/zephyr,bboozzoo/zephyr,mbolivar/zephyr,holtmann/zephyr,jamesonwilliams/zephyr-kernel,runchip/zephyr-cc3220,pklazy/zephyr,runchip/zephyr-cc3220,kraj/zephyr,rsalveti/zephyr,runchip/zephyr-cc3200,holtmann/zephyr,aceofall/zephyr-iotos,mbolivar/zephyr,fractalclone/zephyr-riscv,bigdinotech/zephyr,ldts/zephyr,kraj/zephyr,mirzak/zephyr-os,runchip/zephyr-cc3200,GiulianoFranchetto/zephyr,coldnew/zephyr-project-fork,fractalclone/zephyr-riscv,nashif/zephyr,kraj/zephyr,finikorg/zephyr,sharronliu/zephyr,finikorg/zephyr,zephyriot/zephyr,nashif/zephyr,pklazy/zephyr,zephyrproject-rtos/zephyr,punitvara/zephyr,Vudentz/zephyr,mbolivar/zephyr,fbsder/zephyr,tidyjiang8/zephyr-doc,erwango/zephyr