Logo Search packages:      
Sourcecode: librasterlite version File versions  Download package

local int header_sanity_check ( unsigned char *  buf )

Header sanity check

This function ensures that header contains only legal symbols.

Parameters:
bufData buffer
Returns:
Either EPS_OK or EPS_FORMAT_ERROR

Definition at line 163 of file libmain.c.

References EPS_FORMAT_ERROR, and EPS_OK.

Referenced by read_gs_header(), and read_tc_header().

{
    int i, len;

    len = strlen((char *) buf);

    /* Check header for malicious symbols */
    for (i = 0; i < len; i++) {
        if ((buf[i] >= 'A') && (buf[i] <= 'Z')) {
            continue;
        }

        if ((buf[i] >= 'a') && (buf[i] <= 'z')) {
            continue;
        }

        if ((buf[i] >= '0') && (buf[i] <= '9')) {
            continue;
        }

        if ((buf[i] == ';') || (buf[i] == '=') ||
            (buf[i] == '-') || (buf[i] == ':'))
        {
            continue;
        }

        return EPS_FORMAT_ERROR;
    }

    return EPS_OK;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index