Author: jkim
Date: Fri Dec 11 00:30:41 2020
New Revision: 368538
URL: https://svnweb.freebsd.org/changeset/base/368538

Log:
  MFC:  r367997
  
  Do not truncate the last character from serial number.
  
  strlcpy() requires one more byte for the NULL character.

Modified:
  stable/12/sys/cam/mmc/mmc_da.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/mmc/mmc_da.c
==============================================================================
--- stable/12/sys/cam/mmc/mmc_da.c      Fri Dec 11 00:28:28 2020        
(r368537)
+++ stable/12/sys/cam/mmc/mmc_da.c      Fri Dec 11 00:30:41 2020        
(r368538)
@@ -1262,12 +1262,12 @@ sdda_start_init(void *context, union ccb *start_ccb)
        device->serial_num_len = strlen(softc->card_sn_string);
        device->serial_num = (u_int8_t *)malloc((device->serial_num_len + 1),
            M_CAMXPT, M_NOWAIT);
-       strlcpy(device->serial_num, softc->card_sn_string, 
device->serial_num_len);
+       strlcpy(device->serial_num, softc->card_sn_string, 
device->serial_num_len + 1);
 
        device->device_id_len = strlen(softc->card_id_string);
        device->device_id = (u_int8_t *)malloc((device->device_id_len + 1),
            M_CAMXPT, M_NOWAIT);
-       strlcpy(device->device_id, softc->card_id_string, 
device->device_id_len);
+       strlcpy(device->device_id, softc->card_id_string, device->device_id_len 
+ 1);
 
        strlcpy(mmcp->model, softc->card_id_string, sizeof(mmcp->model));
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to