Skip to content

Conversation

@aakashlahoti
Copy link

No description provided.

@michaelrsweet
Copy link
Contributor

Reopening so we can track these changes and make corrections as needed to fix the build.

@michaelrsweet michaelrsweet added this to the v1.0 milestone Jun 21, 2018
@michaelrsweet michaelrsweet self-assigned this Jun 21, 2018
@michaelrsweet michaelrsweet added the enhancement New feature or request label Jun 21, 2018
@michaelrsweet
Copy link
Contributor

@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 */
Copy link
Contributor

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 */
Copy link
Contributor

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

}
break;
case IPP_TAG_NAMELANG :
{
Copy link
Contributor

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).

Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

Copy link
Contributor

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?

Copy link
Author

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 ?

@aakashlahoti aakashlahoti changed the title GSoC IPPServer Functionality #121 and #122 GSoC IPPServer Functionality #120 #121 #122 Jul 24, 2018
@michaelrsweet
Copy link
Contributor

Holding for later merge, pending other upstream changes coming into libcups.

@michaelrsweet
Copy link
Contributor

A modified version of the changes has been accepted into upstream.

The other changes will need to wait for a future CUPS release, sorry...

@michaelrsweet michaelrsweet modified the milestones: v1.0, Future May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants