=================== Info_RemoveKey =================== */
| 805 | =================== |
| 806 | */ |
| 807 | void Info_RemoveKey( char *s, const char *key ) { |
| 808 | char *start; |
| 809 | char pkey[MAX_INFO_KEY]; |
| 810 | char value[MAX_INFO_VALUE]; |
| 811 | char *o; |
| 812 | |
| 813 | if ( strlen( s ) >= MAX_INFO_STRING ) { |
| 814 | Com_Error( ERR_DROP, "Info_RemoveKey: oversize infostring" ); |
| 815 | } |
| 816 | |
| 817 | if (strchr (key, '\\')) { |
| 818 | return; |
| 819 | } |
| 820 | |
| 821 | while (1) |
| 822 | { |
| 823 | start = s; |
| 824 | if (*s == '\\') |
| 825 | s++; |
| 826 | o = pkey; |
| 827 | while (*s != '\\') |
| 828 | { |
| 829 | if (!*s) |
| 830 | return; |
| 831 | *o++ = *s++; |
| 832 | } |
| 833 | *o = 0; |
| 834 | s++; |
| 835 | |
| 836 | o = value; |
| 837 | while (*s != '\\' && *s) |
| 838 | { |
| 839 | if (!*s) |
| 840 | return; |
| 841 | *o++ = *s++; |
| 842 | } |
| 843 | *o = 0; |
| 844 | |
| 845 | //OJKNOTE: static analysis pointed out pkey may not be null-terminated |
| 846 | if (!strcmp (key, pkey) ) |
| 847 | { |
| 848 | memmove(start, s, strlen(s) + 1); // remove this part |
| 849 | return; |
| 850 | } |
| 851 | |
| 852 | if (!*s) |
| 853 | return; |
| 854 | } |
| 855 | } |
| 856 | |
| 857 | |
| 858 | /* |
no test coverage detected