Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
c9e4611b
...
c9e4611baf7d2b1a0b976e9ff114e9a96be44f73
authored
2003-04-18 12:32:06 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(imap_string): Bugfix. Handle numbers in the input
1 parent
c3bc5251
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
mailbox/imap/folder.c
mailbox/imap/folder.c
View file @
c9e4611
...
...
@@ -44,6 +44,7 @@
#include <mailutils/attribute.h>
#include <mailutils/debug.h>
#include <mailutils/error.h>
#include <mailutils/errno.h>
#include <mailutils/header.h>
#include <mailutils/observer.h>
#include <mailutils/stream.h>
...
...
@@ -1071,6 +1072,24 @@ imap_quoted_string (f_imap_t f_imap, char **ptr)
return
0
;
}
/* A number consists of one or more digit characters, and represents a
numeric value. */
static
int
imap_digits
(
f_imap_t
f_imap
,
char
**
ptr
)
{
char
*
start
=
*
ptr
;
int
len
;
for
(
++*
ptr
;
**
ptr
&&
isdigit
(
**
ptr
);
++*
ptr
)
;
len
=
*
ptr
-
start
;
stream_write
(
f_imap
->
string
.
stream
,
start
,
len
,
f_imap
->
string
.
offset
,
NULL
);
f_imap
->
string
.
offset
+=
len
;
return
0
;
}
/* Find which type of string the response is: literal or quoted and let the
function fill the string buffer. */
static
int
...
...
@@ -1093,9 +1112,11 @@ imap_string (f_imap_t f_imap, char **ptr)
status
=
imap_literal_string
(
f_imap
,
ptr
);
}
break
;
case
'"'
:
status
=
imap_quoted_string
(
f_imap
,
ptr
);
break
;
/* NIL */
case
'N'
:
case
'n'
:
...
...
@@ -1103,9 +1124,13 @@ imap_string (f_imap_t f_imap, char **ptr)
(
*
ptr
)
++
;
/* I|i */
(
*
ptr
)
++
;
/* L|l */
break
;
default:
/* Problem. */
status
=
1
;
if
(
isdigit
(
**
ptr
))
status
=
imap_digits
(
f_imap
,
ptr
);
else
/* Problem. FIXME: Return a more appropriate error code */
status
=
MU_ERR_FAILURE
;
break
;
}
return
status
;
...
...
Please
register
or
sign in
to post a comment