Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68ec6f7b authored by Zhihai Xu's avatar Zhihai Xu
Browse files

if the element attribute string is more than the maximum length, try to send...

if the element attribute string is more than the maximum length, try to send partial attribute instead of empty attribute string .

issue 8470888

Change-Id: Ibfc3a25839bd07bd99dbb3328f56aad1d21720ea
parent 5cee86f8
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -226,14 +226,15 @@ static jboolean getPlayStatusRspNative(JNIEnv *env, jobject object, jint playSta
            env->DeleteLocalRef(text);
            break;
        }

        pAttrs[i].attr_id = attr[i];
        if (strlen(textStr) >= BTRC_MAX_ATTR_STR_LEN) {
            ALOGE("get_element_attr_rsp: string length exceed maximum");
            env->ReleaseStringUTFChars(text, textStr);
            env->DeleteLocalRef(text);
            break;
        }
        pAttrs[i].attr_id = attr[i];
            strncpy((char *)pAttrs[i].text, textStr, BTRC_MAX_ATTR_STR_LEN-1);
            pAttrs[i].text[BTRC_MAX_ATTR_STR_LEN-1] = 0;
        } else {
            strcpy((char *)pAttrs[i].text, textStr);
        }
        env->ReleaseStringUTFChars(text, textStr);
        env->DeleteLocalRef(text);
    }