summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2023-03-27 10:54:58 +0200
committerDaniel Stenberg <daniel@haxx.se>2023-03-28 10:11:33 +0200
commit2203bd13ff27e497030bb4e7ca776a05262c1737 (patch)
treea4bc0924efa0efed0baa7274e3f0175673d43c15
parent01114f6efda64b9ce3492ed7c7964359de70efe5 (diff)
downloadcurl-2203bd13ff27e497030bb4e7ca776a05262c1737.tar.gz
ftplistparser: use ISDIGIT()
Closes #10844
-rw-r--r--lib/ftplistparser.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c
index 703a63e51..77fe52369 100644
--- a/lib/ftplistparser.c
+++ b/lib/ftplistparser.c
@@ -387,8 +387,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) {
/* considering info about FILE response format */
- parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ?
- OS_TYPE_WIN_NT : OS_TYPE_UNIX;
+ parser->os_type = ISDIGIT(buffer[0]) ? OS_TYPE_WIN_NT : OS_TYPE_UNIX;
}
while(i < bufflen) { /* FSM */
@@ -545,7 +544,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
switch(parser->state.UNIX.sub.hlinks) {
case PL_UNIX_HLINKS_PRESPACE:
if(c != ' ') {
- if(c >= '0' && c <= '9') {
+ if(ISDIGIT(c)) {
parser->item_offset = infop->used - 1;
parser->item_length = 1;
parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER;
@@ -572,7 +571,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
parser->state.UNIX.main = PL_UNIX_USER;
parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE;
}
- else if(c < '0' || c > '9') {
+ else if(!ISDIGIT(c)) {
parser->error = CURLE_FTP_BAD_FILE_LIST;
goto fail;
}
@@ -627,7 +626,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
switch(parser->state.UNIX.sub.size) {
case PL_UNIX_SIZE_PRESPACE:
if(c != ' ') {
- if(c >= '0' && c <= '9') {
+ if(ISDIGIT(c)) {
parser->item_offset = infop->used - 1;
parser->item_length = 1;
parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER;