mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-06-14 16:33:54 +00:00
Fix an off by one in strnlena()
I wrote a test case for strnlena() and strndupa() and of course both were off by one in the opposite directions... ... but the next patch obviates the need for them, hopefully, so this will wind up getting dropped.
This commit is contained in:
parent
066a11164e
commit
07724ab645
@ -3,12 +3,11 @@
|
||||
#ifndef SHIM_STR_H
|
||||
#define SHIM_STR_H
|
||||
|
||||
static inline
|
||||
__attribute__((unused))
|
||||
unsigned long strnlena(const CHAR8 *s, unsigned long n)
|
||||
static inline __attribute__((unused)) unsigned long
|
||||
strnlena(const CHAR8 *s, unsigned long n)
|
||||
{
|
||||
unsigned long i;
|
||||
for (i = 0; i <= n; i++)
|
||||
for (i = 0; i < n; i++)
|
||||
if (s[i] == '\0')
|
||||
break;
|
||||
return i;
|
||||
|
Loading…
Reference in New Issue
Block a user