-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GSoC IPPServer Functionality #120 #121 #122 #139
base: master
Are you sure you want to change the base?
Conversation
Reopening so we can track these changes and make corrections as needed to fix the build. |
@aakashlahoti Added review comments to pull request... |
cups/ipp-file.c
Outdated
return (0); | ||
} | ||
memmove(value, value+1, strlen(value)); | ||
value[strlen(value)-1]='\0'; /* Purge parenthesis */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the syntax is:
"string"(language)
then we need to verify that the token we've read starts and ends with "(" and ")".
cups/ipp-file.c
Outdated
{ | ||
if(value[0]=='<') /* Input is binary(in form of hex) values*/ | ||
{ | ||
memmove(value, value+1, strlen(value)); /* Eliminate the '<' sign */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parse the value string into a buffer, don't copy/move stuff around. The buffer just needs to be 32767 bytes, e.g.:
unsigned char data[32767], *dataptr = data;
char *valptr = value + 1;
do
{
while (isxdigit(valptr[0]) && isxdigit(valptr[1]))
{
// Decode hex digits and store in *dataptr;
valptr += 2;
dataptr ++;
if (dataptr >= (data + sizeof(data))
break;
}
if (*valptr == '>')
break;
else if (*valptr)
{
report_error(...);
return (0);
}
if (!_ippFileReadToken(f, value, sizeof(value))
{
report_error(...);
return (0);
}
valptr = value;
}
// data contains data, "dataptr - data" contains length
case IPP_TAG_NAMELANG : | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the same code for IPP_TAG_NAMELANG and IPP_TAG_TEXTLANG (with the two case statements together feeding into the same code).
cups/ipp-file.c
Outdated
{ | ||
while (isxdigit(valptr[0]) && isxdigit(valptr[1])) | ||
{ | ||
char c = valptr[0], d=valptr[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need "tolower" here, as "isxdigit" allows upper and lowercase letters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
@@ -703,6 +696,11 @@ parse_value(_ipp_file_t *f, /* I - IPP data file */ | |||
report_error(f, v, user_data, "No Language Data in line %d of \"%s\".", f->linenum, f->filename); | |||
return (0); | |||
} | |||
if (!(value[0] == '(' && value[strlen(value)-1] == ')')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you need to read another token here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
For input like "my string"(language), the var, value, at line 695, initially contains 'my string' , which then is fed into string.text.
Next a token i.e. (language) is read into var value at line 696, which then is fed into string.language.
I don't think another token needs to be read here, is it ?
Minor changes in parse_value()
Holding for later merge, pending other upstream changes coming into libcups. |
A modified version of the changes has been accepted into upstream. The other changes will need to wait for a future CUPS release, sorry... |
No description provided.