update-manager: Fix finding checksum for a file 93/314493/7
authorSangYoun Kwak <sy.kwak@samsung.com>
Fri, 12 Jul 2024 08:54:11 +0000 (17:54 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Tue, 30 Jul 2024 07:30:04 +0000 (16:30 +0900)
commitcae598a9e9a3af3b0d4178e7ba7176c788038e36
tree2cf5a3774c4ea19a35b38285714192865dcf6143
parent0b9e828225bca1f57899f786ea294d99fbc45d99
update-manager: Fix finding checksum for a file

The read_checksum_for() function reads checksum file and finds a
checksum for the given file name.
Checksum file is consisted with multiple lines, which contains checksum
data and following file name like below:
    <checksum>  <filename>

Previously, the file name is compared with first n bytes, which n is the
length of file name searching for. (without following '\0')
This may lead to faulty match of file name, below is an example:
file name in checksum file: "abcd.efg.hi"
file name searching for: "abcd.efg"
With this condition, the previous code compares only 8 characters, which
is the length of "abcd.efg" so the program considers it as matched.

To fix this situation, checksum and file name are gained using strtok_r
function with delimiter " \n" so the file name can be compared as a
whole.

Change-Id: Iaa14ce35f14b69b613881e375666adc3e5de739d
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
update-manager/common/common-util.c