![Michael Brown](/assets/img/avatar_default.png)
Windows text editors such as Notepad tend to use CRLF line endings, which breaks gPXE's signature detection for script images. Since scripts are usually very small, they end up falling back to being detected as valid PXE executable images (since there are no signature checks for PXE executables). Executing text files as x86 machine code tends not to work well. Fix by allowing for any isspace() character to terminate the "#!gpxe" signature, and by ensuring that CR characters get stripped during command line parsing. Suggested-by: Shao Miller <Shao.Miller@yrdsb.edu.on.ca>
32 lines
501 B
C
32 lines
501 B
C
#ifndef _CTYPE_H
|
|
#define _CTYPE_H
|
|
|
|
/** @file
|
|
*
|
|
* Character types
|
|
*/
|
|
|
|
FILE_LICENCE ( GPL2_OR_LATER );
|
|
|
|
#define isdigit(c) ((c) >= '0' && (c) <= '9')
|
|
#define islower(c) ((c) >= 'a' && (c) <= 'z')
|
|
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
|
|
|
|
static inline unsigned char tolower(unsigned char c)
|
|
{
|
|
if (isupper(c))
|
|
c -= 'A'-'a';
|
|
return c;
|
|
}
|
|
|
|
static inline unsigned char toupper(unsigned char c)
|
|
{
|
|
if (islower(c))
|
|
c -= 'a'-'A';
|
|
return c;
|
|
}
|
|
|
|
extern int isspace ( int c );
|
|
|
|
#endif /* _CTYPE_H */
|